-
Notifications
You must be signed in to change notification settings - Fork 29
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
Invalid Content-Type for get and multipart requests #74
Comments
Hmmm, good thoughts. https://stackoverflow.com/questions/5661596/do-i-need-a-content-type-for-http-get-requests
At the same time, there's no prohibition of I also googled this:
Also this:
And they also say:
I guess So, the fix would mean:
I can do that when I have some time for that. |
Well, I am not a fan of adding another flag which will be true by default. It will be a breaking change to remove that chunk of code, but you can add a code snippet within the changelog how to set default ContentType if someone needs it:
As to the Take your time, I can wait as I've got that workaround and it's not blocking me. I've created this issue especially that FormData looks to be broken. Thanks for your time |
Fixed in |
I wonder if this is actually valid:
https://github.com/catamphetamine/react-website/blob/master/source/HttpRequest.js#L59
GET does not send any content body, so there is no need for
Content-Type
; what's more, google geocode API (https://maps.googleapis.com/maps/api/geocode/json) will return error response whenContent-Type
is set.Multipart/* should specify boundary:
As it's stated in the https://tools.ietf.org/html/rfc2046#section-5.1.1
so it should look something like:
Content-Type: multipart/form-data; boundary=XXX
whereXXX
is the boundary delimiter.Currently, thanks to the previous issue: #73
I was able to modify the request before sending with:
if (request.method === 'GET' || request.header['Content-Type'] === 'multipart/form-data') { request.set('Content-Type', null); }
so it does not add
Content-Type
to the GET request to Google, and superagent automatically adds a proper header with the boundary parameter for form-data.What do you think?
The text was updated successfully, but these errors were encountered: