Skip to content

Commit 9713006

Browse files
authored
fix(discord): release PluralKit 404 bodies (#109960)
1 parent 7c896d7 commit 9713006

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

extensions/discord/src/pluralkit.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ describe("fetchPluralKitMessageInfo", () => {
5959
});
6060

6161
it("returns null on 404", async () => {
62-
const fetcher = vi.fn(async () => buildResponse({ status: 404 }));
62+
const tracked = cancelTrackedResponse("missing", { status: 404 });
63+
const fetcher = vi.fn(async () => tracked.response);
6364
const result = await fetchPluralKitMessageInfo({
6465
messageId: "missing",
6566
config: { enabled: true },
6667
fetcher: fetcher as unknown as typeof fetch,
6768
});
6869
expect(result).toBeNull();
70+
expect(tracked.wasCanceled()).toBe(true);
6971
});
7072

7173
it("returns payload and sends token when configured", async () => {

extensions/discord/src/pluralkit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export async function fetchPluralKitMessageInfo(params: {
6565
signal: timeout.signal,
6666
});
6767
if (res.status === 404) {
68+
await res.body?.cancel().catch(() => undefined);
6869
return null;
6970
}
7071
if (!res.ok) {

0 commit comments

Comments
 (0)