@3846masa/axios-cookiejar-support
Advanced tools
Comparing version 0.0.1 to 0.0.2
21
index.js
@@ -8,3 +8,3 @@ 'use strict'; | ||
function enableCookieJarSupport (instance) { | ||
function axiosCookieJarSupport (instance) { | ||
if (instance.create) { | ||
@@ -14,3 +14,3 @@ const createInstance = instance.create.bind(instance); | ||
const newInstance = createInstance(defaultConfig); | ||
return enableCookieJarSupport(newInstance); | ||
return axiosCookieJarSupport(newInstance); | ||
}; | ||
@@ -24,7 +24,12 @@ } | ||
} | ||
config.$$__jar = | ||
config.$$__jar || | ||
(config.jar === true) | ||
? (instance.defaults.jar || new tough.CookieJar()) | ||
: (config.jar || instance.defaults.jar); | ||
if (!config.$$__jar) { | ||
if (config.jar === true) { | ||
config.$$__jar = (instance.defaults.jar || new tough.CookieJar()); | ||
} else if (config.jar === false) { | ||
config.$$__jar = false; | ||
} else { | ||
config.$$__jar = (config.jar || instance.defaults.jar); | ||
} | ||
} | ||
return origRequest(config); | ||
@@ -58,2 +63,2 @@ }; | ||
module.exports = enableCookieJarSupport; | ||
module.exports = axiosCookieJarSupport; |
@@ -20,3 +20,3 @@ 'use strict'; | ||
config.maxRedirects = 0; | ||
config.validateStatus = null; | ||
config.validateStatus = undefined; | ||
return config; | ||
@@ -23,0 +23,0 @@ }) |
@@ -35,3 +35,3 @@ 'use strict'; | ||
config.baseURL = null; | ||
config.baseURL = undefined; | ||
config.url = response.headers['location']; | ||
@@ -38,0 +38,0 @@ |
{ | ||
"name": "@3846masa/axios-cookiejar-support", | ||
"description": "Convert axios to support tough-cookie.", | ||
"version": "0.0.1", | ||
"description": "Add tough-cookie support to axios.", | ||
"version": "0.0.2", | ||
"author": "3846masa", | ||
@@ -16,9 +16,18 @@ "browser": { | ||
"devDependencies": { | ||
"axios": "0.14.0", | ||
"cookie": "0.3.1", | ||
"decache": "4.1.0", | ||
"eslint": "3.4.0", | ||
"eslint-config-standard": "6.0.0", | ||
"eslint-plugin-promise": "2.0.1", | ||
"eslint-plugin-standard": "2.0.0" | ||
"eslint-plugin-standard": "2.0.0", | ||
"greenkeeper-postpublish": "1.0.1", | ||
"intelli-espower-loader": "1.0.1", | ||
"mocha": "3.0.2", | ||
"nock": "8.0.0", | ||
"power-assert": "1.4.1" | ||
}, | ||
"directories": { | ||
"example": "example" | ||
"example": "example", | ||
"test": "test" | ||
}, | ||
@@ -42,3 +51,6 @@ "homepage": "https://github.com/3846masa/axios-cookiejar-support#readme", | ||
}, | ||
"scripts": {} | ||
"scripts": { | ||
"postpublish": "greenkeeper-postpublish", | ||
"test": "mocha --require intelli-espower-loader" | ||
} | ||
} |
# axios-cookiejar-support | ||
Convert [``axios``] to support [``tough-cookie``]. | ||
Add [``tough-cookie``] support to [``axios``]. | ||
@@ -8,2 +8,11 @@ [``axios``]: https://github.com/mzabriskie/axios | ||
------ | ||
[![NPM](https://img.shields.io/npm/v/@3846masa/axios-cookiejar-support.svg?style=flat-square)][npm] | ||
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license] | ||
[![CircleCI](https://img.shields.io/circleci/project/3846masa/axios-cookiejar-support/master.svg?style=flat-square)][circleci] | ||
[npm]: https://www.npmjs.com/package/@3846masa/axios-cookiejar-support | ||
[license]: https://3846masa.mit-license.org | ||
[circleci]: https://circleci.com/gh/3846masa/axios-cookiejar-support | ||
## Install | ||
@@ -28,3 +37,3 @@ | ||
jar: cookieJar, // tough.CookieJar or boolean | ||
withCredentials: true // If true, send cookie stored in jar. | ||
withCredentials: true // If true, send cookie stored in jar | ||
}) | ||
@@ -56,2 +65,3 @@ .then(() => { | ||
![3846masa icon](https://www.gravatar.com/avatar/cfeae69aae4f4fc102960f01d35d2d86?s=50) | ||
[3846masa](https://github.com/3846masa) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
22684
14
520
65
12
1