From 67a9fcd6670df5efe4a914de85ec0846b3b80cf5 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Tue, 23 Nov 2021 10:04:06 -0800 Subject: Split POST endpoints --- app/controllers/api_account.go | 4 ++-- app/controllers/api_user.go | 4 ++-- cmd/web/server.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/api_account.go b/app/controllers/api_account.go index 8ef18ce..f22191d 100644 --- a/app/controllers/api_account.go +++ b/app/controllers/api_account.go @@ -20,7 +20,7 @@ type APIAccountHandler struct { AdminStore models.AccountStore } -func (h *APIAccountHandler) Register(prefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { +func (h *APIAccountHandler) Register(prefix, postPrefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { // This resource did not exist in the V1 API and thus has no V1 // representation. We use the default handlers for V1 because otherwise // requests with V1 Accept headers would result in 406 Unacceptable errors. @@ -49,7 +49,7 @@ func (h *APIAccountHandler) Register(prefix string, r glecho.URLRouter, mw ...ec contentTypeV2: h.HandlePost, }, } - r.POST(prefix, poh.Handle, mw...) + r.POST(postPrefix, poh.Handle, mw...) r.DELETE(prefix, h.HandleDelete, mw...) } diff --git a/app/controllers/api_user.go b/app/controllers/api_user.go index df667db..f265f26 100644 --- a/app/controllers/api_user.go +++ b/app/controllers/api_user.go @@ -15,7 +15,7 @@ type APIUserHandler struct { Store models.UserStore } -func (h *APIUserHandler) Register(prefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { +func (h *APIUserHandler) Register(prefix, postPrefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { // This resource did not exist in the V1 API and thus has no V1 // representation. We use the default handlers for V1 because otherwise // requests with V1 Accept headers would result in 406 Unacceptable errors. @@ -44,7 +44,7 @@ func (h *APIUserHandler) Register(prefix string, r glecho.URLRouter, mw ...echo. contentTypeV2: h.HandlePost, }, } - r.POST(prefix, poh.Handle, mw...) + r.POST(postPrefix, poh.Handle, mw...) r.DELETE(prefix, h.HandleDelete, mw...) } diff --git a/cmd/web/server.go b/cmd/web/server.go index 5b2e025..9f750bc 100644 --- a/cmd/web/server.go +++ b/cmd/web/server.go @@ -159,7 +159,7 @@ func webMain(cfg app.Config, embeddedTemplates fs.FS, version string) { (&controllers.APIAccountHandler{ Store: as, AdminStore: adminAccountStore, - }).Register("/:account", account) + }).Register("/:account", "", account) } user := api.Group("/user") @@ -168,7 +168,7 @@ func webMain(cfg app.Config, embeddedTemplates fs.FS, version string) { user.GET("", controllers.NewAPIUserListHandler(us)) (&controllers.APIUserHandler{ Store: adminUserStore, - }).Register("/:user", user) + }).Register("/:user", "", user) } } s.GET("/favicon.ico", echo.NotFoundHandler) -- cgit v1.2.3