@3846masa/axios-cookiejar-support
Advanced tools
Comparing version 0.0.4 to 0.0.5
'use strict'; | ||
const url = require('url'); | ||
const settle = require('axios/lib/core/settle'); | ||
@@ -38,3 +39,3 @@ | ||
config.baseURL = undefined; | ||
config.url = response.headers['location']; | ||
config.url = config.url = url.resolve(response.config.url, response.headers['location'] || ''); | ||
@@ -41,0 +42,0 @@ local.redirectCount--; |
{ | ||
"name": "@3846masa/axios-cookiejar-support", | ||
"description": "Add tough-cookie support to axios.", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"author": "3846masa", | ||
@@ -16,13 +16,13 @@ "browser": { | ||
"devDependencies": { | ||
"axios": "0.16.0", | ||
"axios": "0.16.1", | ||
"cookie": "0.3.1", | ||
"decache": "4.1.0", | ||
"eslint": "3.19.0", | ||
"eslint-config-standard": "7.1.0", | ||
"eslint-config-standard": "10.2.1", | ||
"eslint-plugin-promise": "3.5.0", | ||
"eslint-plugin-standard": "2.1.1", | ||
"eslint-plugin-standard": "3.0.1", | ||
"greenkeeper-postpublish": "1.0.1", | ||
"intelli-espower-loader": "1.0.1", | ||
"mocha": "3.2.0", | ||
"nock": "9.0.11", | ||
"mocha": "3.3.0", | ||
"nock": "9.0.13", | ||
"power-assert": "1.4.2" | ||
@@ -29,0 +29,0 @@ }, |
@@ -111,2 +111,49 @@ 'use strict'; | ||
}); | ||
it('should redirect to relative path', () => { | ||
nockHost.post('/').reply(302, null, { | ||
'Location': '/redirect' | ||
}); | ||
nockHost.get('/redirect').reply(200); | ||
return axios.post('https://example.com') | ||
.then((res) => { | ||
assert.strictEqual(res.status, 200); | ||
}); | ||
}); | ||
it('should redirect to relative path, after redirect to different domain', () => { | ||
let anotherNockHost = nock('http://another.com'); | ||
anotherNockHost.get('/redirect').reply(302, null, { | ||
'Location': '/final' | ||
}); | ||
anotherNockHost.get('/final').reply(200, 'final'); | ||
nockHost.post('/').reply(302, null, { | ||
'Location': 'http://another.com/redirect' | ||
}); | ||
return axios.post('http://example.com') | ||
.then((res) => { | ||
assert.strictEqual(res.status, 200); | ||
assert.strictEqual(res.data, 'final'); | ||
}); | ||
}); | ||
it('should redirect to relative path, jumping through a different domain that is different than `baseURL`', () => { | ||
let anotherNockHost = nock('http://another.com'); | ||
anotherNockHost.get('/redirect').reply(302, null, { | ||
'Location': '/final' | ||
}); | ||
anotherNockHost.get('/final').reply(200, 'final'); | ||
nockHost.post('/').reply(302, null, { | ||
'Location': 'http://another.com/redirect' | ||
}); | ||
return axios.create({ baseURL: 'http://example.com' }) | ||
.post('http://example.com') | ||
.then((res) => { | ||
assert.strictEqual(res.status, 200); | ||
assert.strictEqual(res.data, 'final'); | ||
}); | ||
}); | ||
}); | ||
@@ -113,0 +160,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
28862
592