forked from FoundKeyGang/FoundKey
server: fix redirected fetch
Don't throw a StatusError on an intended redirect.
This commit is contained in:
parent
334368f6e2
commit
a0c2cf328e
1 changed files with 5 additions and 1 deletions
|
@ -54,7 +54,11 @@ export async function getResponse(args: { url: string, method: string, body?: st
|
|||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
if (
|
||||
!res.ok
|
||||
&&
|
||||
// intended redirect is not an error
|
||||
!(args.redirect != 'follow' && res.status >= 300 && res.status < 400)) {
|
||||
throw new StatusError(`${res.status} ${res.statusText}`, res.status, res.statusText);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue