Fix `json` option keeping the content-type inherited from a `Request` input body
Before adoption: this commit came in with the history the project adopted, so no landing records it.
A `Request` input constructed with a body gets an automatic `text/plain;charset=UTF-8` content-type. That header was merged in before the `json` option set its own, so the JSON body was sent with the wrong content-type. Only a content-type explicitly passed via `options.headers` now takes precedence over `application/json`.
authored by Sindre Sorhus · committed by Sindre Sorhus · parent 8950864 · Browse files · 4 files+23 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+23 added−2 removed
- tests:+13 added−0 removed
- other:+10 added−2 removed