Skip to content

Commit e4f8783

Browse files
committed
🎉 feat: 0.6.5
2 parents c6ccd38 + 1a9389b commit e4f8783

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const sanitize = D.sanitize
66

77
import './declaration'
88

9-
const isHTMLRegex = /<[^>]*>/g
9+
const isHTMLRegex = /<[^>]*>/
1010
const isHTML = isHTMLRegex.test.bind(isHTMLRegex)
1111

1212
export const html = () =>

test/index.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,15 @@ describe('HTML', () => {
4949
const res = await app.handle(req('/'))
5050
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
5151
})
52+
53+
it('consistently identifies html content', async () => {
54+
const app = new Elysia().use(html()).get('/', () => `<h1>Hi</h1>`)
55+
56+
let res = await app.handle(req('/'))
57+
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
58+
res = await app.handle(req('/'))
59+
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
60+
res = await app.handle(req('/'))
61+
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
62+
})
5263
})

0 commit comments

Comments
 (0)