Skip to content

Commit

Permalink
fix: get form from request
Browse files Browse the repository at this point in the history
it was generating from response
  • Loading branch information
crhntr committed Oct 30, 2024
1 parent 65d2667 commit b3bb1c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit b3bb1c0

Please sign in to comment.