ky
ky copied to clipboard
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Documentation States: ``` hooks: { beforeError: [ error => { const {response} = error; if (response && response.body) { error.name = 'GitHubError'; error.message = `${response.body.message} (${response.statusCode})`; } return error; }...
In case of an 202 there is no way for the HTTP to later send an asynchronous response indicating the outcome of processing the request. When trying to call the...
Hi I really love this library and I can get my way around the source to understand things. But I really think we could improve the documention and include some...
Related to https://github.com/sindresorhus/ky/pull/231, it seems like ky clones the request before every fetch so that a retry with a POST body works. But this continues to prevent using ky in...
Testing in browsers, it seems that referrerPolicy will be unset if request is copied in certain ways: ``` // Test that request initialization with referrerPolicy works > new Request('https://example.com', {referrerPolicy:...
When the browser APIs that `ky` uses become built-in to Node.js, we'll be able to deprecate `ky-universal` in favour of it. - [x] [`fetch`](https://nodejs.org/docs/latest-v18.x/api/globals.html#fetch) (v18.0.0) - [x] [`Headers`](https://nodejs.org/docs/latest-v18.x/api/globals.html#class-headers) (v18.0.0) -...
Retry algorithm has several problems: * [x] Retry `delay(ms)` wait is not abortable by `this._options.signal` , see https://github.com/sindresorhus/ky/blob/2049affe2ca939f53350fb9b7354c3ff8d2e1c1f/source/core/Ky.ts#L228 * Check [sindresorhus/delay](https://github.com/sindresorhus/delay) 😉 * [ ] If `Retry-After` is 0, i.e....
Hi, first off, thanks for making this project! It's a nice wrapper around the native fetch API and now definitely my favorite tool for doing http requests from the browser....
Two Code Snippets ```ts import ky from 'ky'; // Root Ky const rootKy = ky.create({ prefixUrl: '/api', timeout: false, hooks: { beforeRequest: [pruneRequestPayload], beforeRetry: [logError], }, }); // Ky which...