From dfb4845d3b885ceb5f0066f7f76735a0c94e8689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morg=C3=A2n=20von=20Bryl=C3=A2n?= <33571779+MorganVonBrylan@users.noreply.github.com> Date: Sun, 16 Aug 2026 21:33:44 +0200 Subject: [PATCH 1/2] fix: use .status() for 204 responses .sendStatus() sends the status text as the response body. However, a 204 response (No Content) cannot have a body. --- src/structs/Webhook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structs/Webhook.ts b/src/structs/Webhook.ts index 4b3aa7d..c4ffeda 100644 --- a/src/structs/Webhook.ts +++ b/src/structs/Webhook.ts @@ -234,7 +234,7 @@ export class Webhook { `[WARNING] Unable to parse Top.gg webhook payload. Please report this bug to the SDK maintainers.\nCause: ${err.stack || err.message || err}\n--- BEGIN BODY DUMP ---\n${bodyString}\n--- END BODY DUMP ---`, ); - res.sendStatus(204); + res.status(204); return resolve(false); } From 346ddd133f5978cabb4a5d7831f9ae2b746e0fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morg=C3=A2n=20von=20Bryl=C3=A2n?= <33571779+MorganVonBrylan@users.noreply.github.com> Date: Sun, 16 Aug 2026 23:10:06 +0200 Subject: [PATCH 2/2] fix: don't trigger a timeout if the response was sent --- src/structs/Webhook.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/structs/Webhook.ts b/src/structs/Webhook.ts index c4ffeda..c6b0b41 100644 --- a/src/structs/Webhook.ts +++ b/src/structs/Webhook.ts @@ -242,6 +242,10 @@ export class Webhook { ); setTimeout(() => { + if(res.headersSent) { + return; + } + req.destroy(); res.status(408).json({ error: "Request timed out" });