diff --git a/packages/elysia/src/index.ts b/packages/elysia/src/index.ts index 8a1648abb..9381d0d13 100644 --- a/packages/elysia/src/index.ts +++ b/packages/elysia/src/index.ts @@ -42,15 +42,15 @@ export const fedify = ( if (!notFound && !notAcceptable) { set.status = response.status; - response.headers.forEach((value, key) => { - set.headers[key] = value; - }); - // Return response body if it exists if (response.body) { return response; } + response.headers.forEach((value, key) => { + set.headers[key] = value; + }); + // Return empty response for successful requests without body return new Response(null, { status: response.status }); }