Comparing version 0.4.2 to 0.4.3
@@ -163,7 +163,7 @@ "use strict"; | ||
// Check if we were redirected | ||
if (self.options.uri !== response.request.uri) { | ||
if (self.options.uri !== response.request.uri.href) { | ||
if (!res.headers['content-location']) { | ||
// Indicate the redirect via an injected Content-Location | ||
// header | ||
res.headers['content-location'] = response.request.uri; | ||
res.headers['content-location'] = response.request.uri.href; | ||
} else { | ||
@@ -173,3 +173,3 @@ // Make sure that we resolve the returned content-location | ||
res.headers['content-location'] = url.parse(response.request.uri) | ||
.resolve(res.headers['content-location']).toString(); | ||
.resolve(res.headers['content-location']); | ||
} | ||
@@ -176,0 +176,0 @@ } |
{ | ||
"name": "preq", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Yet another promising request wrapper", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,6 +24,5 @@ var preq = require('../index'); | ||
}); | ||
it('get google.com', function() { | ||
it('get enwiki front page', function() { | ||
return preq.get({ | ||
uri: 'http://google.com/', | ||
retries: 2 | ||
uri: 'https://en.wikipedia.org/wiki/Main_Page', | ||
}) | ||
@@ -33,2 +32,4 @@ .then(function(res) { | ||
assert.equal(!!res.body, true); | ||
// Make sure content-location is not set | ||
assert.equal(!!res.headers['content-location'], false); | ||
}); | ||
@@ -38,3 +39,3 @@ }); | ||
return preq.get({ | ||
uri: 'http://google.com', | ||
uri: 'https://en.wikipedia.org/', | ||
retries: 2 | ||
@@ -45,3 +46,4 @@ }) | ||
assert.equal(!!res.body, true); | ||
assert.equal(!!res.headers['content-location'], true); | ||
assert.equal(res.headers['content-location'], | ||
'https://en.wikipedia.org/wiki/Main_Page'); | ||
}); | ||
@@ -48,0 +50,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
28895
742