change the deactivate endpoint to HTTP-POST

This commit is contained in:
Ulrich Schreiner 2015-02-11 07:56:22 +01:00
parent 6158426511
commit aeb6895115
2 changed files with 5 additions and 5 deletions

View file

@ -86,13 +86,13 @@ func DelRepo(c web.C, w http.ResponseWriter, r *http.Request) {
}
}
// PatchRepo accepts a request to inactivate the named
// DeactivateRepo accepts a request to deactivate the named
// repository. This will disable all builds in the system
// for this repository.
//
// PATCH /api/repos/:host/:owner/:name
// POST /api/repos/:host/:owner/:name/deactivate
//
func PatchRepo(c web.C, w http.ResponseWriter, r *http.Request) {
func DeactivateRepo(c web.C, w http.ResponseWriter, r *http.Request) {
var ctx = context.FromC(c)
var repo = ToRepo(c)
@ -106,7 +106,7 @@ func PatchRepo(c web.C, w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusNoContent)
json.NewEncoder(w).Encode(repo)
}
// PostRepo accapets a request to activate the named repository

View file

@ -46,7 +46,7 @@ func New() *web.Mux {
repos.Put("/api/repos/:host/:owner/:name", handler.PutRepo)
repos.Post("/api/repos/:host/:owner/:name", handler.PostRepo)
repos.Delete("/api/repos/:host/:owner/:name", handler.DelRepo)
repos.Patch("/api/repos/:host/:owner/:name", handler.PatchRepo)
repos.Post("/api/repos/:host/:owner/:name/deactivate", handler.DeactivateRepo)
mux.Handle("/api/repos/:host/:owner/:name", repos)
mux.Handle("/api/repos/:host/:owner/:name/*", repos)