When sending multipart/form-data, the Content-Length header is set incorrectly due to the use of new Request #2328
Labels
Content-Length: 221248 | pFad | http://github.com/openapi-ts/openapi-typescript/issues/2328
6BFetched URL: http://github.com/openapi-ts/openapi-typescript/issues/2328
Alternative Proxies:
Uh oh!
There was an error while loading. Please reload this page.
openapi-fetch version
0.14.0
Description
When performing file uploads using multipart/form-data with openapi-fetch, the Content-Length header is being set to approximately double the actual size of the payload compared to plain fetch. This inflated Content-Length is consistently observed because openapi-fetch internally leverages new Request for constructing its requests, which appears to be the root cause of the incorrect header calculation for FormData bodies.
Reproduction
https://github.com/Cigan12/openapi-fetch-reproduction
Expected result
The Content-Length header for multipart/form-data uploads sent via openapi-fetch should accurately represent the byte size of the request body.
Extra
The text was updated successfully, but these errors were encountered: