Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ Version 1.8.16

To be released.

### @fedify/elysia

- Fixed duplicate response headers on Elysia 1.4.18 and earlier, which
append both `set.headers` and the returned `Response`'s own headers
without deduplication. The `fedify()` plugin no longer sets the headers
in both places. [[#970], [#972] by dktsudgg]

[#970]: https://github.com/fedify-dev/fedify/issues/970
[#972]: https://github.com/fedify-dev/fedify/pull/972


Version 1.8.15
--------------
Expand Down
8 changes: 4 additions & 4 deletions packages/elysia/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export const fedify = <TContextData = unknown>(
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 });
}
Expand Down