Skip to content

multipart/form-data does not allow browser to set boundary expression #1191

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

Closed
1 task done
psychedelicious opened this issue Jul 1, 2023 · 0 comments · Fixed by #1192
Closed
1 task done

multipart/form-data does not allow browser to set boundary expression #1191

psychedelicious opened this issue Jul 1, 2023 · 0 comments · Fixed by #1192
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library

Comments

@psychedelicious
Copy link
Contributor

Description

multipart/form-data content type requires a boundary expression to serve as a form field delimiter in body.

If you set Content-Type to multipart/form-data explicitly, the browser does not set boundary.

openapi-fetch either sets application/json or uses whatever the user provided, so it's currently not possible for it to allow the browser to correctly set the boundary.

Reproduction

I can create one if really needed

Checklist

@nilsso

@psychedelicious psychedelicious added bug Something isn't working openapi-fetch Relevant to the openapi-fetch library labels Jul 1, 2023
psychedelicious added a commit to psychedelicious/openapi-typescript that referenced this issue Jul 1, 2023
We need to delete the `Content-Type` header if the serialized body is a `FormData`. This allows the browser to set the `Content-Type` and boundary expression correctly.

Resolves openapi-ts#1191
psychedelicious added a commit to psychedelicious/openapi-typescript that referenced this issue Jul 1, 2023
We need to delete the `Content-Type` header if the serialized body is a `FormData`. This allows the browser to set the `Content-Type` and boundary expression correctly.

Resolves openapi-ts#1191
psychedelicious added a commit to psychedelicious/openapi-typescript that referenced this issue Jul 1, 2023
We need to delete the `Content-Type` header if the serialized body is a `FormData`. This allows the browser to set the `Content-Type` and boundary expression correctly.

Resolves openapi-ts#1191
drwpow pushed a commit that referenced this issue Jul 3, 2023
* fix(openapi-fetch): fix headers for FormData

We need to delete the `Content-Type` header if the serialized body is a `FormData`. This allows the browser to set the `Content-Type` and boundary expression correctly.

Resolves #1191

* fix(openapi-fetch): revert unnecessary change

`baseHeaders` is still the same object via reference, we can just access it directly.
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

Successfully merging a pull request may close this issue.

1 participant