filter cookies with same names before sending
duplicate names may occur if we store cookies with the same name for example.com with subdomains and for sub.example.com
This commit is contained in:
parent
14a874f208
commit
f613a8c32e
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-fetch-cookies",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-fetch-cookies",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "node-fetch wrapper that adds support for cookie-jars",
|
||||
"main": "src/index.mjs",
|
||||
"engines": {
|
||||
|
|
|
@ -16,6 +16,7 @@ async function cookieFetch(cookieJars, url, options) {
|
|||
domains
|
||||
.map(d => [...jar.iterValidForRequest(d, url)])
|
||||
.reduce((a, b) => [...a, ...b])
|
||||
.filter((v, i, a) => a.slice(0, i).every(c => c.name !== v.name)) //unique
|
||||
.forEach(c => cookies += c.serialize() + "; ");
|
||||
if(cookieJars) {
|
||||
if(Array.isArray(cookieJars) && cookieJars.every(c => c instanceof CookieJar)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user