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

URL-decode all inputs #321

Closed
1 of 3 tasks
ocramz opened this issue Oct 3, 2023 · 3 comments · Fixed by #392
Closed
1 of 3 tasks

URL-decode all inputs #321

ocramz opened this issue Oct 3, 2023 · 3 comments · Fixed by #392

Comments

@ocramz
Copy link
Collaborator

ocramz commented Oct 3, 2023

related : #8

closes #170

@ocramz
Copy link
Collaborator Author

ocramz commented Oct 3, 2023

NB remember to import http-api-data for the decoding functionality : https://hackage.haskell.org/package/http-api-data

@ocramz ocramz changed the title Add handler for url-encoded forms URL-decode all inputs Oct 3, 2023
@jfraudeau
Copy link
Contributor

Regarding path segment inputs, they are already decoded by WAI/Warp in Request.pathInfo. Same goes for queryParams

I believe #262 is fixed by #302

@pbrinkmeier
Copy link
Contributor

I just created my first PR at #392 :)

Basically path segments, query parameters and form data are handled by warp and therefore already decoded when they are accessed by scotty actions. When using warp, path segements are ultimately handled by Network.HTTP.Types.decodePathSegmentsand parameters are handled by Network.HTTP.Types.parseQuery. Both of those call Network.HTTP.Types.urlDecode internally. I added some tests for that.

And like the other PR, I added a formData action that can decode records with FormData instances from http-api-data.

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

Successfully merging a pull request may close this issue.

3 participants