Skip to content

When sending multipart/form-data, the Content-Length header is set incorrectly due to the use of new Request #2328

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

Open
1 task done
Cigan12 opened this issue May 21, 2025 · 0 comments
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library

Comments

@Cigan12
Copy link

Cigan12 commented May 21, 2025

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

@Cigan12 Cigan12 added bug Something isn't working openapi-fetch Relevant to the openapi-fetch library labels May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

No branches or pull requests

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy