@@ -254,6 +254,25 @@ describe('various response body types', () => {
254254 } )
255255 return response
256256 } )
257+ app . get ( '/text-with-content-length-array' , ( ) => {
258+ const response = new Response ( 'Hello Hono!' , {
259+ headers : [
260+ [ 'content-type' , 'text/plain' ] ,
261+ [ 'content-length' , '00011' ] ,
262+ ] ,
263+ } )
264+ return response
265+ } )
266+ app . get ( '/text-with-set-cookie-array' , ( ) => {
267+ const response = new Response ( 'Hello Hono!' , {
268+ headers : [
269+ [ 'content-type' , 'text/plain' ] ,
270+ [ 'set-cookie' , 'a=1' ] ,
271+ [ 'set-cookie' , 'b=2' ] ,
272+ ] ,
273+ } )
274+ return response
275+ } )
257276
258277 app . use ( '/etag/*' , etag ( ) )
259278 app . get ( '/etag/buffer' , ( ) => {
@@ -400,6 +419,22 @@ describe('various response body types', () => {
400419 expect ( res . text ) . toBe ( 'Hello Hono!' )
401420 } )
402421
422+ it ( 'Should return 200 response - GET /text-with-content-length-array' , async ( ) => {
423+ const res = await request ( server ) . get ( '/text-with-content-length-array' )
424+ expect ( res . status ) . toBe ( 200 )
425+ expect ( res . headers [ 'content-type' ] ) . toMatch ( 'text/plain' )
426+ expect ( res . headers [ 'content-length' ] ) . toBe ( '00011' )
427+ expect ( res . text ) . toBe ( 'Hello Hono!' )
428+ } )
429+
430+ it ( 'Should return 200 response - GET /text-with-set-cookie-array' , async ( ) => {
431+ const res = await request ( server ) . get ( '/text-with-set-cookie-array' )
432+ expect ( res . status ) . toBe ( 200 )
433+ expect ( res . headers [ 'content-type' ] ) . toMatch ( 'text/plain' )
434+ expect ( res . headers [ 'set-cookie' ] ) . toEqual ( [ 'a=1' , 'b=2' ] )
435+ expect ( res . text ) . toBe ( 'Hello Hono!' )
436+ } )
437+
403438 it ( 'Should return 200 response - GET /etag/buffer' , async ( ) => {
404439 const res = await request ( server ) . get ( '/etag/buffer' )
405440 expect ( res . status ) . toBe ( 200 )
0 commit comments