[v3] Add credentials to RequestInit
See original GitHub issueIs your feature request related to a problem? Please describe.
node-fetch
’s request type does not include credentials
: https://github.com/node-fetch/node-fetch/blob/cbd4d895767e33491219e40013dd8daa5c7ac024/%40types/index.d.ts#L56
This is a field provided by the web platform: https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
Describe the solution you’d like
Add credentials
field
Describe alternatives you’ve considered
I could work around it, but would prefer not to have to
Additional context
This is used in the upcoming SvelteKit: https://github.com/sveltejs/kit/blob/95c47bcdb884194359475968b1e0eeb342820611/packages/kit/src/runtime/server/page/load_node.js#L129
SvelteKit’s predecessor Sapper did something similar as well: https://github.com/sveltejs/sapper/blob/339c417b24e8429d3adc9c9f196bf159a5fce874/runtime/src/server/middleware/get_page_handler.ts#L137
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:6 (1 by maintainers)
Top GitHub Comments
the only thing we could support is the
omit
the other two (same-site and include) would have the same meaning on backendSo there is a tiny usecase for it… but since we don’t have a cookie jar either… then it have even less usefulness
We don’t want things to work on the server-side and then break on the client-side because it’d be very difficult for users to see different behavior depending on whether they did a server-side or client-side navigation to the page. All we were requesting here was to change the type so that we can check
if (opts.credentials !== 'omit')
ourselves without running into an issue ofcredentials
not being defined on the type. I wasn’t suggesting to change thenode-fetch
behaviorLet’s leave the SvelteKit discussion in that repository to avoid confusing this issue