-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
Full compatibility with Bun #516
Comments
Ky just passes the option through to
|
Yes, it is, only proxy is not a native option it is a development of the Bun team, maybe that's why it doesn't work in Ky. |
Just a hunch... does it work if you don't use .json()? Ky does a bit of extra processing on the options if you use .json(). |
Without calling .text()|.json(), I can't check the response to be sure. @sindresorhus Are you planning to address this issue)? |
What I should have said is to use response.json() instead of the ky().json() shortcut. They are different. |
Show me an example, it's not clear. |
Your code example does this: const json = await ky(targetUrl, { proxy }).json();
console.log(json); ^^ that is what we refer to as the "json shortcut". It's a shortcut because you are calling Compare that with const response = await fetch(targetUrl, { proxy });
console.log(await response.json()); Ky's json shortcut is optional. You can still the await the response and call its const response = await ky(targetUrl, { proxy });
console.log(await response.json()); In theory, there should not be much difference between all of the above constructs. But Ky does do a bit of extra work when you use the json shortcut, including adding an I would like to know if using Ky without the json shortcut changes the result of your test, so that we can rule that out as a cause. |
I tried this option and unfortunately nothing changed, the proxies still don't work. const response = await ky(targetUrl, { proxy });
console. log(await response.json()); |
Okay, I think I know what's happening here. While it's true that Ky tries to pass any unknown options through to fetch (such as this non-standard I suspect that this won't work: const request = new Request(targetUrl, { proxy });
const response = await fetch(request);
console. log(await response.json()); That is essentially what Ky is doing. The Bun team probably didn't anticipate it would need to be passed that way. I see two possible solutions. Both should probably be implemented but either would suffice for your particular case.
Solution 1 is likely easier to implement, so I think we should start there. File a feature request with Bun asking for |
Hi, it looks like ky is working in Bun (bun.sh), you need support for Bun fetch types, for example Bun implements the ability to use a proxy in a request
But it doesn't work through ky. Please adapt the library for Bun
The text was updated successfully, but these errors were encountered: