Closed c-eliasson closed 2 years ago
@c-eliasson Sorry for this, I'll investigate asap.
@c-eliasson
Allright so I just released v1.7.9
including a fix which, I hope, will solve the problem.
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.