File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const { compile } = require('@kitajs/html')
8
8
9
9
import './declaration'
10
10
11
- const isHTMLRegex = / < [ ^ > ] * > / g
11
+ const isHTMLRegex = / < [ ^ > ] * > /
12
12
const isHTML = isHTMLRegex . test . bind ( isHTMLRegex )
13
13
14
14
export const html = ( ) =>
Original file line number Diff line number Diff line change @@ -49,4 +49,15 @@ describe('HTML', () => {
49
49
const res = await app . handle ( req ( '/' ) )
50
50
expect ( res . headers . get ( 'Content-type' ) ) . toContain ( 'text/html; charset=utf8' )
51
51
} )
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
+ } )
52
63
} )
You can’t perform that action at this time.
0 commit comments