File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ test('should not compress on missing header', t => {
146
146
} )
147
147
} )
148
148
149
- test ( 'Should not compress on missing header ' , t => {
149
+ test ( 'Should close the stream ' , t => {
150
150
t . plan ( 3 )
151
151
const fastify = Fastify ( )
152
152
fastify . register ( compressPlugin , { global : false } )
@@ -159,10 +159,18 @@ test('Should not compress on missing header', t => {
159
159
160
160
fastify . inject ( {
161
161
url : '/' ,
162
- method : 'GET'
162
+ method : 'GET' ,
163
+ headers : {
164
+ 'accept-encoding' : 'compress'
165
+ }
163
166
} , res => {
164
- t . strictEqual ( res . statusCode , 200 )
165
- t . notOk ( res . headers [ 'content-encoding' ] )
167
+ const payload = JSON . parse ( res . payload )
168
+ t . strictEqual ( res . statusCode , 406 )
169
+ t . deepEqual ( {
170
+ error : 'Not Acceptable' ,
171
+ message : 'Unsupported encoding' ,
172
+ statusCode : 406
173
+ } , payload )
166
174
} )
167
175
} )
168
176
You can’t perform that action at this time.
0 commit comments