Skip to content

fix: infer media-type for falsy bodies except 'undefined' #2066

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

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

fpoppinga
Copy link
Contributor

@fpoppinga fpoppinga commented Mar 13, 2024

This fixes a bug, where the Content-Type header would be reset to the default, when the request.body contains a falsy value.

For example, given using the fetch api, when sending a request with body 0 (i.e. the number zero), the Content-Type header would default to text/plain; utf-8 (which is the browser default), even when application/json would be expected (and would be set if the request body was e.g. 1, i.e. the number one).

@ferdikoomen ferdikoomen merged commit 7ac99d4 into ferdikoomen:master Mar 17, 2024
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