sindresorhus / ky

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

Does ky support RequestCache? #501

Closed Talent30 closed 1 year ago

Talent30 commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/API/Request/cache

Please consider the following example. When we set cache option ky doesn't work as expected in Next.js but wretch does.

How to reproduce: npm run build

Expected behaviour Next.js shouldn't fetch during build

https://codesandbox.io/p/sandbox/polished-thunder-x35x7z?file=%2Fapp%2Fpage.tsx&selection=%5B%7B%22endColumn%22%3A13%2C%22endLineNumber%22%3A22%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A20%7D%5D

sindresorhus commented 1 year ago

Ky simply passes that option to Fetch. So if you have a problem with it, it is a problem with Fetch or the Fetch polyfill you use.

Talent30 commented 1 year ago

Thank you @sindresorhus