@3846masa/axios-cookiejar-support
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -5,2 +5,3 @@ "use strict"; | ||
const http_1 = require("http-cookie-agent/http"); | ||
const AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT = Symbol('AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT'); | ||
function requestInterceptor(config) { | ||
@@ -14,7 +15,20 @@ if (!config.jar) { | ||
} | ||
if (config.httpAgent || config.httpsAgent) { | ||
if ((config.httpAgent != null && config.httpAgent[AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT] !== true) || | ||
(config.httpsAgent != null && config.httpsAgent[AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT] !== true)) { | ||
throw new Error('axios-cookiejar-support does not support for use with other http(s).Agent.'); | ||
} | ||
config.httpAgent = new http_1.HttpCookieAgent({ cookies: { jar: config.jar } }); | ||
Object.defineProperty(config.httpAgent, AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT, { | ||
configurable: false, | ||
enumerable: false, | ||
value: true, | ||
writable: false, | ||
}); | ||
config.httpsAgent = new http_1.HttpsCookieAgent({ cookies: { jar: config.jar } }); | ||
Object.defineProperty(config.httpsAgent, AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT, { | ||
configurable: false, | ||
enumerable: false, | ||
value: true, | ||
writable: false, | ||
}); | ||
return config; | ||
@@ -21,0 +35,0 @@ } |
{ | ||
"name": "@3846masa/axios-cookiejar-support", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "Add tough-cookie support to axios.", | ||
@@ -59,15 +59,15 @@ "keywords": [ | ||
"devDependencies": { | ||
"@3846masa/configs": "github:3846masa/configs#8ae5f7cc4740f9fc2f9d773dcb91ec920a1e7fe2", | ||
"@3846masa/configs": "github:3846masa/configs#8a58b51d1ee96d29ce9cfddc5eb490aa45fb1e37", | ||
"@ava/typescript": "3.0.1", | ||
"@semantic-release/changelog": "6.0.1", | ||
"@semantic-release/changelog": "6.0.2", | ||
"@semantic-release/exec": "6.0.3", | ||
"@semantic-release/git": "10.0.1", | ||
"@types/node": "14.18.22", | ||
"@types/node": "14.18.35", | ||
"@types/tough-cookie": "4.0.2", | ||
"ava": "4.3.1", | ||
"ava": "4.3.3", | ||
"axios": "0.27.2", | ||
"npm-run-all": "4.1.5", | ||
"semantic-release": "19.0.3", | ||
"tough-cookie": "4.0.0", | ||
"typescript": "4.7.4" | ||
"semantic-release": "19.0.5", | ||
"tough-cookie": "4.1.2", | ||
"typescript": "4.9.4" | ||
}, | ||
@@ -74,0 +74,0 @@ "peerDependencies": { |
@@ -54,2 +54,9 @@ # axios-cookiejar-support | ||
## FAQ | ||
- Q. Why can't I assign the httpAgent / httpsAgent? | ||
- A. axios-cookiejar-support uses httpAgent / httpsAgent to read and write cookies. If other Agents are assigned, cookies cannot be read/written. | ||
- Q. I want to use it with another Agent (e.g., http-proxy-agent). | ||
- A. Consider using http-cookie-agent. axios-cookiejar-support also uses http-cookie-agent. Read http-cookie-agent's README for more details. | ||
## Contributing | ||
@@ -56,0 +63,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7362
64
68