mirror of
https://git.coolaj86.com/coolaj86/request.js
synced 2025-04-20 06:10:38 +00:00
Merge branch 'redirect' of Joxit/urequest.js into master
This commit is contained in:
commit
c4ec14fb6a
2
index.js
2
index.js
@ -85,7 +85,7 @@ function setDefaults(defs) {
|
|||||||
resp.request.headers = finalOpts.headers;
|
resp.request.headers = finalOpts.headers;
|
||||||
resp.request.toJSON = toJSONifier([ 'uri', 'method', 'headers' ]);
|
resp.request.toJSON = toJSONifier([ 'uri', 'method', 'headers' ]);
|
||||||
|
|
||||||
if (followRedirect && resp.headers.location && -1 !== [ 301, 302 ].indexOf(resp.statusCode)) {
|
if (followRedirect && resp.headers.location && -1 !== [ 301, 302, 307, 308 ].indexOf(resp.statusCode)) {
|
||||||
debug('Following redirect: ' + resp.headers.location);
|
debug('Following redirect: ' + resp.headers.location);
|
||||||
if ('GET' !== opts.method && !opts.followAllRedirects) {
|
if ('GET' !== opts.method && !opts.followAllRedirects) {
|
||||||
followRedirect = false;
|
followRedirect = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user