Add HTTP codes 307 and 308 for redirect
See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
This commit is contained in:
parent
137da9b903
commit
e1bc24ce97
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…
Reference in New Issue