From 1289c3af880273ca4d3266c57b859ed4bfa79ddc Mon Sep 17 00:00:00 2001 From: Hein Date: Wed, 19 Nov 2025 14:04:56 +0200 Subject: [PATCH] Fixed handling post routes as well for the restheadspec --- pkg/restheadspec/restheadspec.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/restheadspec/restheadspec.go b/pkg/restheadspec/restheadspec.go index 736ed9c..d51effe 100644 --- a/pkg/restheadspec/restheadspec.go +++ b/pkg/restheadspec/restheadspec.go @@ -106,7 +106,7 @@ func SetupMuxRoutes(muxRouter *mux.Router, handler *Handler) { reqAdapter := router.NewHTTPRequest(r) respAdapter := router.NewHTTPResponseWriter(w) handler.Handle(respAdapter, reqAdapter, vars) - }).Methods("GET", "PUT", "PATCH", "DELETE") + }).Methods("GET", "PUT", "PATCH", "DELETE", "POST") // GET for metadata (using HandleGet) muxRouter.HandleFunc("/{schema}/{entity}/metadata", func(w http.ResponseWriter, r *http.Request) { @@ -189,6 +189,18 @@ func SetupBunRouterRoutes(bunRouter *router.StandardBunRouterAdapter, handler *H return nil }) + r.Handle("POST", "/:schema/:entity/:id", func(w http.ResponseWriter, req bunrouter.Request) error { + params := map[string]string{ + "schema": req.Param("schema"), + "entity": req.Param("entity"), + "id": req.Param("id"), + } + reqAdapter := router.NewBunRouterRequest(req) + respAdapter := router.NewHTTPResponseWriter(w) + handler.Handle(respAdapter, reqAdapter, params) + return nil + }) + r.Handle("PUT", "/:schema/:entity/:id", func(w http.ResponseWriter, req bunrouter.Request) error { params := map[string]string{ "schema": req.Param("schema"),