Skip to content

Commit 90ea094

Browse files
committed
🧹 fix: add test case for headers
1 parent 4262085 commit 90ea094

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.1.1 - 25 Apr 2023
2+
Fix:
3+
- derive from context header
4+
15
# 0.1.0-rc.3 - 13 Dec 2022
26
Improvement:
37
- Add support for Elysia 0.1.0-rc.5

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elysiajs/html",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Plugin for Elysia that add support for returning html",
55
"author": {
66
"name": "saltyAom",
@@ -43,4 +43,4 @@
4343
"rimraf": "^3.0.2",
4444
"typescript": "^4.8.4"
4545
}
46-
}
46+
}

test/index.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,15 @@ describe('HTML', () => {
3838
const res = await app.handle(req('/'))
3939
expect(res.headers.get('Content-Type')).toBe('text/html')
4040
})
41+
42+
it('inherits header', async () => {
43+
const app = new Elysia().use(html()).get('/', ({ html, set }) => {
44+
set.headers.Server = 'Elysia'
45+
46+
return html
47+
})
48+
49+
const res = await app.handle(req('/'))
50+
expect(res.headers.get('Server')).toBe('Elysia')
51+
})
4152
})

0 commit comments

Comments
 (0)