fix: use /env routes for env var CRUD, fixing 404 on env var forms
All checks were successful
Check / check (pull_request) Successful in 3m7s
All checks were successful
Check / check (pull_request) Successful in 3m7s
Change route patterns in routes.go from /env-vars to /env and update edit/delete form actions in app_detail.html to match. The add form already used /env and was correct. Update test route setup to match the new /env paths. Closes #156
This commit is contained in:
@@ -732,11 +732,11 @@ func TestHandleEnvVarDeleteUsesCorrectRouteParam(t *testing.T) {
|
||||
|
||||
// Use chi router with the real route pattern to test param name
|
||||
r := chi.NewRouter()
|
||||
r.Post("/apps/{id}/env-vars/{varID}/delete", testCtx.handlers.HandleEnvVarDelete())
|
||||
r.Post("/apps/{id}/env/{varID}/delete", testCtx.handlers.HandleEnvVarDelete())
|
||||
|
||||
request := httptest.NewRequest(
|
||||
http.MethodPost,
|
||||
"/apps/"+createdApp.ID+"/env-vars/"+strconv.FormatInt(envVar.ID, 10)+"/delete",
|
||||
"/apps/"+createdApp.ID+"/env/"+strconv.FormatInt(envVar.ID, 10)+"/delete",
|
||||
nil,
|
||||
)
|
||||
recorder := httptest.NewRecorder()
|
||||
|
||||
@@ -82,9 +82,9 @@ func (s *Server) SetupRoutes() {
|
||||
r.Post("/apps/{id}/start", s.handlers.HandleAppStart())
|
||||
|
||||
// Environment variables
|
||||
r.Post("/apps/{id}/env-vars", s.handlers.HandleEnvVarAdd())
|
||||
r.Post("/apps/{id}/env-vars/{varID}/edit", s.handlers.HandleEnvVarEdit())
|
||||
r.Post("/apps/{id}/env-vars/{varID}/delete", s.handlers.HandleEnvVarDelete())
|
||||
r.Post("/apps/{id}/env", s.handlers.HandleEnvVarAdd())
|
||||
r.Post("/apps/{id}/env/{varID}/edit", s.handlers.HandleEnvVarEdit())
|
||||
r.Post("/apps/{id}/env/{varID}/delete", s.handlers.HandleEnvVarDelete())
|
||||
|
||||
// Labels
|
||||
r.Post("/apps/{id}/labels", s.handlers.HandleLabelAdd())
|
||||
|
||||
Reference in New Issue
Block a user