Skip to content

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

Open
@Cigan12

Description

@Cigan12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-fetchRelevant to the openapi-fetch library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions