stop retries after wrong content-type

It does not make sense to re-request the same resource with the same
parameters and expect a different content-type to be returned. Also
this makes the error message more sensible and understandable.
This commit is contained in:
Johann150 2024-02-19 07:50:19 +01:00
parent 4b3154c22c
commit fba8536743
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -121,9 +121,10 @@ export async function signedGet(_url: string, user: { id: User['id'] }): Promise
return false;
};
if (isActivitypub(res.headers.get('Content-Type'))) {
return await res.json();
if (!isActivitypub(res.headers.get('Content-Type'))) {
throw new Error('invalid response content type');
}
return await res.json();
}
}