You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
First, thanks a lot for this great library, it's very useful in one of the projects I am working on.
I spent some to find the reason of the bug below so I thought to put it here for reference. Feel free to close the issue.
=> PR #1826 was a breaking change on our side as we migrated from 0.8.x to 0.12.x
POST requests with FormData were failing with Content-Type of type multipart must include a boundary parameter.
Reason is:
We had some code that was setting headers.set('Content-Type', 'multipart/form-data') (no idea why 🤔).
This header was removed in openapi-fetch prior to the PR. So the browser was setting the correct Content-Type.
After this PR, the header is now left in headers and therefore the browser does not set the correct Content-Type.
Hence the issue.
We fixed it by removing the line above.
Best! And again feel free to close this issue.
The text was updated successfully, but these errors were encountered:
I ran into the same issue where setting 'Content-Type': 'multipart/form-data' in request headers caused the FormData payload to be sent as an empty object { }. Initially, I set the request header like this in both the middleware and the service:
But the payload was empty. When I tried using native fetch in Next.js, everything worked fine, and the FormData was correctly sent with the full payload. I thought maybe I shouldn’t set the Content-Type manually, so I modified the service like this:
However, it seems like openapi-fetch overrides the Content-Type and defaults to application/json, preventing the FormData from being processed correctly.
Description
Hello,
First, thanks a lot for this great library, it's very useful in one of the projects I am working on.
I spent some to find the reason of the bug below so I thought to put it here for reference. Feel free to close the issue.
=> PR #1826 was a breaking change on our side as we migrated from 0.8.x to 0.12.x
POST requests with
FormData
were failing withContent-Type of type multipart must include a boundary parameter
.Reason is:
We had some code that was setting
headers.set('Content-Type', 'multipart/form-data')
(no idea why 🤔).This header was removed in
openapi-fetch
prior to the PR. So the browser was setting the correct Content-Type.After this PR, the header is now left in headers and therefore the browser does not set the correct Content-Type.
Hence the issue.
We fixed it by removing the line above.
Best! And again feel free to close this issue.
The text was updated successfully, but these errors were encountered: