fix(federation): 🐛 Don't consume body of response

This commit is contained in:
Jesse Wierzbinski 2024-07-26 17:11:30 +02:00
parent 6160ebd7c4
commit db92a51412
No known key found for this signature in database

View file

@ -139,7 +139,9 @@ export class FederationRequester {
const isJson = result.headers.get("Content-Type")?.includes("json"); const isJson = result.headers.get("Content-Type")?.includes("json");
if (!result.ok) { if (!result.ok) {
const error = isJson ? await result.json() : await result.text(); const error = isJson
? await result.clone().json()
: await result.clone().text();
throw new ResponseError( throw new ResponseError(
{ {
data: error, data: error,
@ -154,7 +156,9 @@ export class FederationRequester {
} }
return { return {
data: isJson ? await result.json() : (await result.text()) || null, data: isJson
? await result.clone().json()
: (await result.clone().text()) || null,
ok: true, ok: true,
raw: result, raw: result,
request, request,