valeriangalliat / fetch-cookie

Decorator for a `fetch` function to support automatic cookie storage and population. 🍪
The Unlicense
135 stars 29 forks source link

Getting error: res.headers.raw is not a function #42

Closed M-Nasab closed 2 years ago

M-Nasab commented 4 years ago

I get this error when i use this library:

Uncaught (in promise) TypeError: res.headers.raw is not a function at fetchCookie (index.js?a60e:41)
fabiante commented 4 years ago

This could happen because fetch-cookie assumes you use node-fetch v2 and may fail if you aren't:

https://github.com/valeriangalliat/fetch-cookie/blob/4fcbe62f460f093ec7f48d720eee1e325e1fac62/index.js#L40-L41

What fetch implementation are you using in what environment?

greggilbert commented 3 years ago

FWIW I've got this happening right now, using node-fetch 2.6.1. Replicated in both Firefox and Safari.

valeriangalliat commented 2 years ago

Hey! I just published v2.0.0 with improved support for various fetch implementations!

headers.raw was pretty specific to node-fetch but now fetch-cookie also supports any fetch implementation compatible with the WHATWG Fetch standard API (as long as it exposes the set-cookie header)