diff --git a/package-lock.json b/package-lock.json index afb6c75..80cf5db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "node-fetch-cookies", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a7cb486..860a563 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/index.mjs b/src/index.mjs index c339f0c..fe56b98 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -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)) {