This is specific to the XhrBackend implementation, based on request body types for which it doesn't automatically set Content-Type headers.
When forming "write" requests inside of http.request, the "Content-Type" header should be set for certain request body types that the user agent doesn't implicitly set, using the body extraction steps described here: https://fetch.spec.whatwg.org/#concept-bodyinit-extract
- JSON -> application/json
- URLSearchParams -> application/x-www-form-urlencoded;charset=UTF-8
- Blob -> If blob has set "type" property, set to its value
This should also be documented.
Will leave FormData up to the user-agent, so it can set the appropriate boundary.
This is specific to the XhrBackend implementation, based on request body types for which it doesn't automatically set Content-Type headers.
When forming "write" requests inside of
http.request, the "Content-Type" header should be set for certain request body types that the user agent doesn't implicitly set, using the body extraction steps described here: https://fetch.spec.whatwg.org/#concept-bodyinit-extractThis should also be documented.
Will leave
FormDataup to the user-agent, so it can set the appropriate boundary.