Closed
Description
When performing file uploads to raw endpoints using multipart/form-data we need to set a boundary in the Content-Type
header to delineate the different parts of the request payload. fetch
handles this natively for us when a FormData object is passed to it.
The auto-generated JS/TS clients are configured to set the Content-Type
header to application/json for every request, without exception. Currently we can pass an overridden header for Content-Type
, but that requires us to handle the boundary manually, which is not great.
Our options are to:
- In our overridden
fetch
implementation, check the type of the body and delete theapplication/json
header if present (as it's already set at this point) - Only set the
application/json
header if the body is notFormData
, as in these cases we should allow fetch to natively handle the setting ofContent-Type
including boundary
Metadata
Metadata
Assignees
Labels
No labels
Activity