From 4e54d51d146fc91cf6e3e1393b132345efdf5bb5 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sat, 14 Mar 2026 18:32:01 +0100 Subject: [PATCH] fix: skip body and Content-Type for GET/HEAD webhooks --- jetstream.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jetstream.ts b/jetstream.ts index feba7b8..6731760 100644 --- a/jetstream.ts +++ b/jetstream.ts @@ -24,16 +24,17 @@ const fireWebhooks = async ( const webhooks = getWebhooksByDid(did); if (webhooks.length === 0) return; const results = await Promise.allSettled( - webhooks.map(({ method, url, token }) => - fetch(url, { + webhooks.map(({ method, url, token }) => { + const hasBody = method !== "GET" && method !== "HEAD"; + return fetch(url, { method, headers: { - "Content-Type": "application/json", + ...(hasBody ? { "Content-Type": "application/json" } : {}), ...(token ? { Authorization: `Bearer ${token}` } : {}), }, - body: JSON.stringify(payload), - }) - ), + body: hasBody ? JSON.stringify(payload) : undefined, + }); + }), ); for (const result of results) { if (result.status === "rejected") {