Custom fetch options are stripped from the request. Next.js cache doesn't work properly. #1569
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
openapi-fetch
Relevant to the openapi-fetch library
Description
Openapi-fetch uses a request object for its fetch.
openapi-typescript/packages/openapi-fetch/src/index.js
Line 101 in 9c277fb
The request object created by openapi-fetch strips away non standard fetch options, i.e. how Next.js passes its cache related params:
More info on Next.js fetching data + caching
Reproduction
Try to pass next cache params in https://github.com/drwpow/openapi-typescript/blob/main/packages/openapi-fetch/examples/nextjs/app/page.tsx
It won't change its behaviour, it always falls back to defaults, because the non standard ones are stripped away.
I've tried
I changed this line
openapi-typescript/packages/openapi-fetch/src/index.js
Line 101 in 9c277fb
to
and it works, but I don't know if it would cause other problems.
The text was updated successfully, but these errors were encountered: