Browse Source

Merge pull request #25 from floatdrop/rewrite-redirect-condition

Change order of comparsions and header check
http2
Sindre Sorhus 10 years ago
parent
commit
3f87b8553b
  1. 2
      index.js

2
index.js

@ -59,7 +59,7 @@ function got(url, opts, cb) {
var res = response;
// redirect
if (statusCode < 400 && statusCode >= 300 && res.headers.location) {
if (statusCode >= 300 && statusCode < 400 && 'location' in res.headers) {
if (++redirectCount > 10) {
cb(new Error('Redirected 10 times. Aborting.'), undefined, res);
return;

Loading…
Cancel
Save