Open jeanmatthieud opened 2 weeks ago
A quick, non-ideal workaround on your end might be to change ky(request, options)
to just ky(request)
. Does that solve it?
As for a more permanent fix, perhaps we should move the code for deleting content-type
out of the searchParams
condition. Hopefully that doesn't break anything...
Hi,
I tried to upload some content with the FormData Web API and Ky (latest release).
Something like this:
I also have a custom ky instance, named in my example "api". This instance is based on the afterResponseHook example, to manage API authentication.
I discovered that the call to
ky(request, options)
doesn't regenerate the "content-type" header, which creates a boundary mismatch between the header and the request content.I looked in the ky source code, and it seems that a patch already exists, but only for requests with searchParams, which is not my case:
https://github.com/sindresorhus/ky/blob/585ebcb80545d784b31033e5a70326a0eb202468/source/core/Ky.ts#L194
https://github.com/sindresorhus/ky/blob/585ebcb80545d784b31033e5a70326a0eb202468/source/core/Ky.ts#L184