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

Split content-type header value #203

Merged
merged 2 commits into from
Feb 15, 2022
Merged

Split content-type header value #203

merged 2 commits into from
Feb 15, 2022

Conversation

yawaramin
Copy link
Contributor

Some clients add a suffix to the value, e.g.
"application/x-www-form-urlencoded; charset=UTF-8". In this case we want to
throw away the extra data before checking the content-type.

@yawaramin
Copy link
Contributor Author

Another option would be:

match String.sub ct 0 33 with
| "application/x-www-form-urlencoded" -> ...

Let me know if you prefer that.

yawaramin and others added 2 commits February 15, 2022 08:38
Some clients add a suffix to the value, e.g.
`"application/x-www-form-urlencoded; charset=UTF-8"`. In this case we want to
throw away the extra data before checking the content-type.
Function Form.form has received several edits over the past months, and
it needed an overall cleanup, especially since Dream itself has also
changed internal layout and some conventions.
@aantron
Copy link
Owner

aantron commented Feb 15, 2022

Thank you!

Another option would be:

match String.sub ct 0 33 with
| "application/x-www-form-urlencoded" -> ...

Let me know if you prefer that.

It looks like either version would allocate. This version allocates less, but what we really would want from an allocations point of view is a String.startswith in the standard library.

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.

None yet

2 participants