0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

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

This commit is contained in:
Yusuke Wada 2024-09-08 15:50:54 +09:00 committed by GitHub
parent 6f69bf04b7
commit 39600c4449
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -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')

View File

@ -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)