return the last result
This commit is contained in:
parent
4406b16455
commit
389d5fd426
|
@ -40,7 +40,7 @@ async function fetch(cookieJars, url, options) {
|
||||||
if (wantFollow) {
|
if (wantFollow) {
|
||||||
options.redirect = 'manual'
|
options.redirect = 'manual'
|
||||||
}
|
}
|
||||||
const result = await _fetch(url, options);
|
let result = await _fetch(url, options);
|
||||||
// I cannot use headers.get() here because it joins the cookies to a string
|
// I cannot use headers.get() here because it joins the cookies to a string
|
||||||
cookies = result.headers[Object.getOwnPropertySymbols(result.headers)[0]]["set-cookie"];
|
cookies = result.headers[Object.getOwnPropertySymbols(result.headers)[0]]["set-cookie"];
|
||||||
if(cookies && cookieJars) {
|
if(cookies && cookieJars) {
|
||||||
|
@ -55,7 +55,7 @@ async function fetch(cookieJars, url, options) {
|
||||||
if (wantFollow && redirectStatus.has(result.status)) {
|
if (wantFollow && redirectStatus.has(result.status)) {
|
||||||
const location = result.headers.get('Location')
|
const location = result.headers.get('Location')
|
||||||
options.redirect = 'follow'
|
options.redirect = 'follow'
|
||||||
await fetch(cookieJars, location, options)
|
result = await fetch(cookieJars, location, options)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user