-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
1.7.8 introduce breaking behavior in payload json serialization #123
Comments
@c-eliasson Sorry for this, I'll investigate asap. |
Allright so I just released Sorry again for the regression 🙇. |
@elbywan Wow, thanks for the swift reply! I'll take it for a spinn as soon as I get a chance. Will get back to you shortly. |
@elbywan Can confirm that bumping to 1.7.9 resolved the issue, and the automatic payload serialization now appear to work as expected for us again. Thanks for the quick fix, and the great work you're doing with wretch! 👏 |
With the release of 1.7.8, a breaking change was introduced in how payload serialization works when no explicit content-type has been set.
Under HTTP methods the documentation states:
We've relied on this and simply call
.post({ foo: 'bar' })
to send a json serialized payload, without explicitly specifying the content-type. This has worked fine up until 1.7.7, but broke with the 1.7.8 release.After digging through the changes in 1.7.8, I believe I've found the problematic commit. The problem seems to be this line. If I'm not missing something, it relies on no headers at all being set in order for the automatic json serialization to work. In our case we set the authorization header on all requests, which in our case means
base._options.headers
is defined, even though we haven't set any other headers.I haven't had time to create a repro or look into a fix unfortunately, but after looking at the code I believe this is the issue.
Workaround
For anyone running into this issue, switching to 1.7.7 solve the problem.
The text was updated successfully, but these errors were encountered: