-
Notifications
You must be signed in to change notification settings - Fork 20
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
Posting FormData as body (for file uploads) not possible anymore #174
Comments
What version of |
Currently 4.3.2, but I also briefly tried with 5.x which seemed to result in the same 🤔 |
OK, thanks for the hint, @glasser. I will look into |
5.x is the version where we addressed a several year of bug reports. It ought to work with FormData out of the box, as long as you're using a FormData implementation that's compatible with your fetch implementation. The default fetch implementation is |
@glasser I now tried with v5 and the file upload still doesn't work. I used
But
This makes it look like the contents of that property are somehow removed before sent to the data source, no? Atm I just wouldn't know why. |
If you provide a full reproduction with no creativity required to try it out, I'd be happy to give it a look. This stuff is subtle enough that it can't really be debugged from snippets. |
Thanks @glasser, but I found the issue. It was a discrepancy between the boundary of the |
Hi,
we currently still use
apollo-datasource-rest
, with which it’s possible to pass abody
that isFormData
as a second argument to thepost
method of a data source. That’s what we did for file uploads in our app, which also seems to be the most straight-forward approach. But with@apollo/datasource-rest
that’s not possible anymore.Looking at the source code of the
fetch
method of both packages, it seems like now everything that is not passing the following conditions (which are present in both) is being ignored:With
apollo-datasource-rest
a body which fell through that if statement was simply passed on as is.What is the reasoning behind not allowing something non-stringified to be sent? Security?
The text was updated successfully, but these errors were encountered: