sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API
MIT License
11.91k stars 342 forks source link

Pass unknown options to fetch #536

Closed kdelmonte closed 8 months ago

kdelmonte commented 9 months ago

This PR implements option number 2 of this comment by @sholladay.

Ky starts passing unknown options directly to fetch instead of relying on the Request class to do it for us. This is the right thing for Ky to do but might prove to be a little tricky. We would need to either pass all options to fetch, which could inadvertently override some of our options processing logic that's done with the Request class, or have some kind of filtering system to only pass unknown options to fetch, which would presumably involve some kind of hardcoded list of known options (which would have to include all options that the Request class understands) and that doesn't sound fun.

Fixes #531 Fixes #516

Also, tested this against Next.js v13.5.5 patched fetch and I can verify that it works.

doroved commented 8 months ago
image

Thanks, everything works, but now how to deal with TS? In bun fetch the type for proxy is there, how to use it in ky?

doroved commented 8 months ago
image

Type in bun

kdelmonte commented 8 months ago

This PR caused #539 which is being resolved with #540.

doroved commented 8 months ago

This PR caused #539 which is being resolved with #540.

So what to do with TS types? I provided information above

kdelmonte commented 8 months ago

@doroved , please create a separate issue and provide all the details of what you think needs to be done.

loxK commented 8 months ago

This PR caused #539 which is being resolved with #540.

A couple of hours of debugging an app to finally find out that regression....