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

Support decoding of application/x-www-form-urlencoded forms #1118

Open
nguiard opened this issue Oct 10, 2023 · 0 comments
Open

Support decoding of application/x-www-form-urlencoded forms #1118

nguiard opened this issue Oct 10, 2023 · 0 comments

Comments

@nguiard
Copy link
Contributor

nguiard commented Oct 10, 2023

Hi! Thanks a lot for this library!

As HTTP.jl supports queryparams to decode parameters of a query string, I am surprised there's no facility to decode forms encoded in application/x-www-form-urlencoded. Especially as this is the default encoding for web forms.

Important to note is that the encoding is actually slightly different from query strings in URLs, so you can't just use queryparams as is on the body. The key difference is that a space character is encoded as a + in x-www-form-urlencoded while it is encoded as a %20 in URIs (https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding).

While one can easily write a homegrown function in their project to take care of it, this body encoding is so ubiquitous that I suggest HTTP.jl should offer a standard function to decode it, and also an example in the documentation. Not doing so can also be error-prone for people not familiar with web forms: looking around a bit, they might think they can just use queryparams on the body, not realizing this is incorrect.

If you're fine with that, I can prepare a PR to add this functionality as well as a nice example of using it :)

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

No branches or pull requests

1 participant