Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jsx-renderer): set Content-Encoding when stream is true #3355

Merged
merged 1 commit into from
Sep 8, 2024
Merged
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
1 change: 1 addition & 0 deletions src/middleware/jsx-renderer/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ describe('JSX renderer', () => {
expect(res.status).toBe(200)
expect(res.headers.get('Transfer-Encoding')).toEqual('chunked')
expect(res.headers.get('Content-Type')).toEqual('text/html; charset=UTF-8')
expect(res.headers.get('Content-Encoding')).toEqual('Identity')

if (!res.body) {
throw new Error('Body is null')
Expand Down
1 change: 1 addition & 0 deletions src/middleware/jsx-renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const createRenderer =
if (options.stream === true) {
c.header('Transfer-Encoding', 'chunked')
c.header('Content-Type', 'text/html; charset=UTF-8')
c.header('Content-Encoding', 'Identity')
} else {
for (const [key, value] of Object.entries(options.stream)) {
c.header(key, value)
Expand Down