diff options
author | Mike Crute <mike@crute.us> | 2021-11-23 10:04:06 -0800 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2021-11-23 10:04:06 -0800 |
commit | 67a9fcd6670df5efe4a914de85ec0846b3b80cf5 (patch) | |
tree | a371bdabeb4f4bf66176d064fe2ffcf57d5c105b | |
parent | 853cab121191a2cf4dd37c68149fc23b64235464 (diff) | |
download | cloud-identity-broker-67a9fcd6670df5efe4a914de85ec0846b3b80cf5.tar.bz2 cloud-identity-broker-67a9fcd6670df5efe4a914de85ec0846b3b80cf5.tar.xz cloud-identity-broker-67a9fcd6670df5efe4a914de85ec0846b3b80cf5.zip |
Split POST endpoints
-rw-r--r-- | app/controllers/api_account.go | 4 | ||||
-rw-r--r-- | app/controllers/api_user.go | 4 | ||||
-rw-r--r-- | 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 { | |||
20 | AdminStore models.AccountStore | 20 | AdminStore models.AccountStore |
21 | } | 21 | } |
22 | 22 | ||
23 | func (h *APIAccountHandler) Register(prefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { | 23 | func (h *APIAccountHandler) Register(prefix, postPrefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { |
24 | // This resource did not exist in the V1 API and thus has no V1 | 24 | // This resource did not exist in the V1 API and thus has no V1 |
25 | // representation. We use the default handlers for V1 because otherwise | 25 | // representation. We use the default handlers for V1 because otherwise |
26 | // requests with V1 Accept headers would result in 406 Unacceptable errors. | 26 | // 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 | |||
49 | contentTypeV2: h.HandlePost, | 49 | contentTypeV2: h.HandlePost, |
50 | }, | 50 | }, |
51 | } | 51 | } |
52 | r.POST(prefix, poh.Handle, mw...) | 52 | r.POST(postPrefix, poh.Handle, mw...) |
53 | 53 | ||
54 | r.DELETE(prefix, h.HandleDelete, mw...) | 54 | r.DELETE(prefix, h.HandleDelete, mw...) |
55 | } | 55 | } |
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 { | |||
15 | Store models.UserStore | 15 | Store models.UserStore |
16 | } | 16 | } |
17 | 17 | ||
18 | func (h *APIUserHandler) Register(prefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { | 18 | func (h *APIUserHandler) Register(prefix, postPrefix string, r glecho.URLRouter, mw ...echo.MiddlewareFunc) { |
19 | // This resource did not exist in the V1 API and thus has no V1 | 19 | // This resource did not exist in the V1 API and thus has no V1 |
20 | // representation. We use the default handlers for V1 because otherwise | 20 | // representation. We use the default handlers for V1 because otherwise |
21 | // requests with V1 Accept headers would result in 406 Unacceptable errors. | 21 | // 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. | |||
44 | contentTypeV2: h.HandlePost, | 44 | contentTypeV2: h.HandlePost, |
45 | }, | 45 | }, |
46 | } | 46 | } |
47 | r.POST(prefix, poh.Handle, mw...) | 47 | r.POST(postPrefix, poh.Handle, mw...) |
48 | 48 | ||
49 | r.DELETE(prefix, h.HandleDelete, mw...) | 49 | r.DELETE(prefix, h.HandleDelete, mw...) |
50 | } | 50 | } |
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) { | |||
159 | (&controllers.APIAccountHandler{ | 159 | (&controllers.APIAccountHandler{ |
160 | Store: as, | 160 | Store: as, |
161 | AdminStore: adminAccountStore, | 161 | AdminStore: adminAccountStore, |
162 | }).Register("/:account", account) | 162 | }).Register("/:account", "", account) |
163 | } | 163 | } |
164 | 164 | ||
165 | user := api.Group("/user") | 165 | user := api.Group("/user") |
@@ -168,7 +168,7 @@ func webMain(cfg app.Config, embeddedTemplates fs.FS, version string) { | |||
168 | user.GET("", controllers.NewAPIUserListHandler(us)) | 168 | user.GET("", controllers.NewAPIUserListHandler(us)) |
169 | (&controllers.APIUserHandler{ | 169 | (&controllers.APIUserHandler{ |
170 | Store: adminUserStore, | 170 | Store: adminUserStore, |
171 | }).Register("/:user", user) | 171 | }).Register("/:user", "", user) |
172 | } | 172 | } |
173 | } | 173 | } |
174 | s.GET("/favicon.ico", echo.NotFoundHandler) | 174 | s.GET("/favicon.ico", echo.NotFoundHandler) |