- From: Justin Grant <notifications@github.com>
- Date: Thu, 17 Feb 2022 16:51:13 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/1384/1043684795@github.com>
> That being said, fetch-cookie cannot currently work with undici because the `set-cookie` header is not exposed by the `fetch` API (as per [spec](https://fetch.spec.whatwg.org/#forbidden-response-header-name)) so in reality fetch-cookie can only be used alongside node-fetch for now. @valeriangalliat, this statement seems to contradict what @devsnek says in https://github.com/nodejs/node/pull/41749#issuecomment-1025314789: > you can still use cookies with the current api, you are able to read `set-cookie` headers in responses and set `cookie` headers in requests. I confirmed on Node 17.5 and I am able to read the `Set-Cookie` header: ```js (await fetch('https://wikipedia.com/')).headers.get('set-cookie') // => 'WMF-Last-Access=18-Feb-2022;Path=/;HttpOnly;secure;Expires=Tue, 22 Mar 2022 00:00:00 GMT, WMF-Last-Access-Global=18-Feb-2022;Path=/;Domain=.wikipedia.org;HttpOnly;secure;Expires=Tue, 22 Mar 2022 00:00:00 GMT, GeoIP=(REDACTED!); Path=/; secure; Domain=.wikipedia.org' ``` > The main issue I have with a `fetch` wrapper is that the redirect logic must be re-implemented. [node-fetch does a fantastic job at handling redirects](https://github.com/node-fetch/node-fetch/blob/5e78af3ba7555fa1e466e804b2e51c5b687ac1a2/src/index.js#L169) and I'm pretty sure undici does too, so it makes me sad to have to bypass that upstream redirect implementation in order to re-implement it in the wrapper. This is error prone and requires duplicated efforts in maintenance. I strongly agree with this point. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/1384#issuecomment-1043684795 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/issues/1384/1043684795@github.com>
Received on Friday, 18 February 2022 00:51:25 UTC