From aeb68951158871b8ef41d3cc56d4d74d6eea89ed Mon Sep 17 00:00:00 2001 From: Ulrich Schreiner Date: Wed, 11 Feb 2015 07:56:22 +0100 Subject: [PATCH] change the deactivate endpoint to HTTP-POST --- server/handler/repo.go | 8 ++++---- server/router/router.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/handler/repo.go b/server/handler/repo.go index a299bc2a..2bf54bcd 100644 --- a/server/handler/repo.go +++ b/server/handler/repo.go @@ -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 diff --git a/server/router/router.go b/server/router/router.go index 51bc2c6d..b197d067 100644 --- a/server/router/router.go +++ b/server/router/router.go @@ -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)