fix(discord): release PluralKit 404 bodies (#109960)

This commit is contained in:
RileyJJY
2026-07-21 09:37:36 +08:00
committed by GitHub
parent 7c896d7859
commit 97130060df
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -59,13 +59,15 @@ describe("fetchPluralKitMessageInfo", () => {
});
it("returns null on 404", async () => {
const fetcher = vi.fn(async () => buildResponse({ status: 404 }));
const tracked = cancelTrackedResponse("missing", { status: 404 });
const fetcher = vi.fn(async () => tracked.response);
const result = await fetchPluralKitMessageInfo({
messageId: "missing",
config: { enabled: true },
fetcher: fetcher as unknown as typeof fetch,
});
expect(result).toBeNull();
expect(tracked.wasCanceled()).toBe(true);
});
it("returns payload and sends token when configured", async () => {
+1
View File
@@ -65,6 +65,7 @@ export async function fetchPluralKitMessageInfo(params: {
signal: timeout.signal,
});
if (res.status === 404) {
await res.body?.cancel().catch(() => undefined);
return null;
}
if (!res.ok) {