diff --git a/src/api/f.ts b/src/api/f.ts index 59c85dc..18f3bd8 100644 --- a/src/api/f.ts +++ b/src/api/f.ts @@ -42,6 +42,10 @@ export async function getLoginHash(token: string, timestamp: string | number, us signal, }).finally(cancel); + if (response.status !== 200) { + throw new ErrorResponse('[s2s] Non-200 status code', response, await response.text()); + } + const data = await response.json() as LoginHashApiResponse | LoginHashApiError; if ('error' in data) { @@ -87,6 +91,10 @@ export async function flapg( signal, }).finally(cancel); + if (response.status !== 200) { + throw new ErrorResponse('[flapg] Non-200 status code', response, await response.text()); + } + const data = await response.json() as FlapgApiResponse; debugFlapg('Got f parameter "%s"', data.result.f); @@ -160,6 +168,10 @@ export async function iminkf( signal, }).finally(cancel); + if (response.status !== 200) { + throw new ErrorResponse('[imink] Non-200 status code', response, await response.text()); + } + const data = await response.json() as IminkFResponse | IminkFError; if ('error' in data) { @@ -228,6 +240,10 @@ export async function genf( signal, }).finally(cancel); + if (response.status !== 200) { + throw new ErrorResponse('[znca-api] Non-200 status code', response, await response.text()); + } + const data = await response.json() as AndroidZncaFResponse | AndroidZncaFError; if ('error' in data) {