fix(fetch): network error on multiple redirects (#5985)

This commit is contained in:
Marcos Casagrande 2020-05-31 22:13:53 +02:00 committed by GitHub
parent ecb94c06e9
commit 08552fc6b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

View file

@ -288,6 +288,7 @@ export async function fetch(
}
}
let responseInit: ResponseInit = {};
while (remRedirectCount) {
const fetchResponse = await sendFetchReq(url, method, headers, body);
@ -314,7 +315,7 @@ export async function fetch(
},
});
let responseInit: ResponseInit = {
responseInit = {
status: fetchResponse.status,
statusText: fetchResponse.statusText,
headers: fetchResponse.headers,
@ -374,6 +375,12 @@ export async function fetch(
return response;
}
}
// Return a network error due to too many redirections
throw notImplemented();
responseData.set(responseInit, {
type: "error",
redirected: false,
url: "",
});
return new Response(null, responseInit);
}