-
-
Notifications
You must be signed in to change notification settings - Fork 440
Description
Hello,
We were currently running into an issue, that with the new node version of 18.18.2 (where they introduced a security fix for undici) and the latest version of ky (1.1.0), headers are not properly set on the request with a json payload.
I tracked it down to this line of code:
Line 203 in d372e2e
| this.request = new globalThis.Request(this.request, {body: this._options.body}); |
Basically, with the node version 18.18.2, as soon a new Request is being created, it loses all the options (including headers) that were set on this.request, resulting in a new Request with only content-type: text/plain;charset=UTF-8 being set. In node 18.18.1, everything is working fine
I was able to make it work by spreading out the options.
this.request = new globalThis.Request(this.request, { ...this._options, body: this._options.body });
However, it's hard for me to tell if this is actually a bug in node (undici), or if it was never supposed to work like this and they fixed it with the new version.