From b3bb1c02f14fe5f27b05651dadd7cb149900e6bb Mon Sep 17 00:00:00 2001 From: Chrstopher Hunter <8398225+crhntr@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:32:21 -0700 Subject: [PATCH] fix: get form from request it was generating from response --- routes.go | 2 +- routes_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes.go b/routes.go index 1444f3a..205764d 100644 --- a/routes.go +++ b/routes.go @@ -690,7 +690,7 @@ func formDeclaration(imports *source.Imports, ident string, typeExp ast.Expr) *a Names: []*ast.Ident{ast.NewIdent(ident)}, Type: typeExp, Values: []ast.Expr{ - &ast.SelectorExpr{X: ast.NewIdent(httpResponseField(imports).Names[0].Name), Sel: ast.NewIdent("Form")}, + &ast.SelectorExpr{X: ast.NewIdent(httpRequestField(imports).Names[0].Name), Sel: ast.NewIdent("Form")}, }, }, }, diff --git a/routes_test.go b/routes_test.go index 289b6f6..c515d0d 100644 --- a/routes_test.go +++ b/routes_test.go @@ -740,7 +740,7 @@ type RoutesReceiver interface { func routes(mux *http.ServeMux, receiver RoutesReceiver) { mux.HandleFunc("GET /", func(response http.ResponseWriter, request *http.Request) { request.ParseForm() - var form url.Values = response.Form + var form url.Values = request.Form data := receiver.F(form) execute(response, request, true, "GET / F(form)", http.StatusOK, data) })