|
@ -61,13 +61,13 @@ function got(url, opts, cb) { |
|
|
|
|
|
|
|
|
// redirect
|
|
|
// redirect
|
|
|
if (statusCode >= 300 && statusCode < 400 && 'location' in res.headers) { |
|
|
if (statusCode >= 300 && statusCode < 400 && 'location' in res.headers) { |
|
|
|
|
|
res.resume(); // Discard response
|
|
|
|
|
|
|
|
|
if (++redirectCount > 10) { |
|
|
if (++redirectCount > 10) { |
|
|
cb(new Error('Redirected 10 times. Aborting.'), undefined, res); |
|
|
cb(new Error('Redirected 10 times. Aborting.'), undefined, res); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
res.resume(); // Discard response
|
|
|
|
|
|
|
|
|
|
|
|
get(urlLib.resolve(url, res.headers.location), opts, cb); |
|
|
get(urlLib.resolve(url, res.headers.location), opts, cb); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|