Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] add form decoding #157

Merged
merged 1 commit into from
Oct 25, 2024
Merged

[feature] add form decoding #157

merged 1 commit into from
Oct 25, 2024

Conversation

muir
Copy link
Owner

@muir muir commented Oct 25, 2024

The form annotation didn't previously do anything.

It now does. On query parameters, if you say form or formOnly then if the body is application/x-www-form-urlencoded then it will decode the body and fill in the parameters from the body.

If formOnly is used, than that parameter will only come from the body and will not come from the query string.

This is somewhat backwards incompatible because previously form was defined but it didn't do anything.

@muir muir force-pushed the formDecode branch 2 times, most recently from b92f0cf to 403c51a Compare October 25, 2024 19:43
@muir muir merged commit 66559cc into main Oct 25, 2024
19 checks passed
@muir muir deleted the formDecode branch October 25, 2024 20:42
@@ -195,7 +196,9 @@ var deepObjectRE = regexp.MustCompile(`^([^\[]+)\[([^\]]+)\]$`) // id[name]
// allowReserved=false # default
// allowReserved=true # query parameters only
// form=false # default
// form=true # cookies only
// form=true # query paramters only, may extract value from application/x-www-form-urlencoded POST content

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add that if confilict, data from POST content will have higher precidence? and maybe add a test example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants