@@ -11,9 +11,9 @@ const { closeServerAsPromise } = require('../utils/node-http')
11
11
test ( 'content-encoding header' , async ( t ) => {
12
12
const { strictEqual } = tspl ( t , { plan : 2 } )
13
13
14
- const contentEncoding = 'gzip, br '
14
+ const contentEncoding = 'deflate, gzip '
15
15
const text = 'Hello, World!'
16
- const gzipBrotliText = Buffer . from ( 'CxCAH4sIAAAAAAAAA/NIzcnJ11EIzy/KSVEEANDDSuwNAAAAAw== ' , 'base64' )
16
+ const gzipDeflateText = Buffer . from ( 'H4sIAAAAAAAAA6uY89nj7MmT1wM5zuuf8gxkYZCfx5IFACQ8u/wVAAAA ' , 'base64' )
17
17
18
18
const server = createServer ( { joinDuplicateHeaders : true } , ( req , res ) => {
19
19
res . writeHead ( 200 ,
@@ -22,26 +22,26 @@ test('content-encoding header', async (t) => {
22
22
'Content-Type' : 'text/plain'
23
23
}
24
24
)
25
- . end ( gzipBrotliText )
25
+ . end ( gzipDeflateText )
26
26
} )
27
27
t . after ( closeServerAsPromise ( server ) )
28
28
29
29
await once ( server . listen ( 0 ) , 'listening' )
30
30
31
31
const response = await fetch ( `http://localhost:${ server . address ( ) . port } ` )
32
32
33
- strictEqual ( await response . text ( ) , text )
34
33
strictEqual ( response . headers . get ( 'content-encoding' ) , contentEncoding )
34
+ strictEqual ( await response . text ( ) , text )
35
35
36
36
await t . completed
37
37
} )
38
38
39
39
test ( 'content-encoding header is case-iNsENsITIve' , async ( t ) => {
40
40
const { strictEqual } = tspl ( t , { plan : 2 } )
41
41
42
- const contentEncoding = 'GZiP, bR '
42
+ const contentEncoding = 'DeFlAtE, GzIp '
43
43
const text = 'Hello, World!'
44
- const gzipBrotliText = Buffer . from ( 'CxCAH4sIAAAAAAAAA/NIzcnJ11EIzy/KSVEEANDDSuwNAAAAAw== ' , 'base64' )
44
+ const gzipDeflateText = Buffer . from ( 'H4sIAAAAAAAAA6uY89nj7MmT1wM5zuuf8gxkYZCfx5IFACQ8u/wVAAAA ' , 'base64' )
45
45
46
46
const server = createServer ( { joinDuplicateHeaders : true } , ( req , res ) => {
47
47
res . writeHead ( 200 ,
@@ -50,32 +50,6 @@ test('content-encoding header is case-iNsENsITIve', async (t) => {
50
50
'Content-Type' : 'text/plain'
51
51
}
52
52
)
53
- . end ( gzipBrotliText )
54
- } )
55
- t . after ( closeServerAsPromise ( server ) )
56
-
57
- await once ( server . listen ( 0 ) , 'listening' )
58
-
59
- const response = await fetch ( `http://localhost:${ server . address ( ) . port } ` )
60
-
61
- strictEqual ( await response . text ( ) , text )
62
- strictEqual ( response . headers . get ( 'content-encoding' ) , contentEncoding )
63
-
64
- await t . completed
65
- } )
66
-
67
- test ( 'response decompression according to content-encoding should be handled in a correct order' , async ( t ) => {
68
- const { strictEqual } = tspl ( t , { plan : 1 } )
69
-
70
- const contentEncoding = 'deflate, gzip'
71
- const text = 'Hello, World!'
72
- const gzipDeflateText = Buffer . from ( 'H4sIAAAAAAAAA6uY89nj7MmT1wM5zuuf8gxkYZCfx5IFACQ8u/wVAAAA' , 'base64' )
73
-
74
- const server = createServer ( { joinDuplicateHeaders : true } , ( req , res ) => {
75
- res . writeHead ( 200 , {
76
- 'Content-Encoding' : contentEncoding ,
77
- 'Content-Type' : 'text/plain'
78
- } )
79
53
. end ( gzipDeflateText )
80
54
} )
81
55
t . after ( closeServerAsPromise ( server ) )
@@ -84,6 +58,7 @@ test('response decompression according to content-encoding should be handled in
84
58
85
59
const response = await fetch ( `http://localhost:${ server . address ( ) . port } ` )
86
60
61
+ strictEqual ( response . headers . get ( 'content-encoding' ) , contentEncoding )
87
62
strictEqual ( await response . text ( ) , text )
88
63
89
64
await t . completed
0 commit comments