@@ -240,6 +240,33 @@ describe('node-static (CLI)', function () {
240240 assert . equal ( text , 'hello world' , 'should respond with hello world' ) ;
241241 } ) ;
242242
243+ it ( 'serving file within directory and gzip but without gzip accept request' , async function ( ) {
244+ const { response /* , stdout */ } = await spawnConditional ( binFile , [
245+ '-p' , this . port , fixturePath , '--gzip'
246+ ] , timeout - 9000 , {
247+ condition : / s e r v i n g " .* ?" / ,
248+ action : ( /* err, stdout */ ) => {
249+ return fetch (
250+ `http://localhost:${ this . port } /hello.txt` , {
251+ headers : {
252+ 'accept-encoding' : 'nothing'
253+ }
254+ }
255+ ) ;
256+ }
257+ } ) ;
258+
259+ const { status} = response ;
260+ const contentType = response . headers . get ( 'content-type' ) ;
261+ const contentEncoding = response . headers . get ( 'content-encoding' ) ;
262+ const text = await response . text ( ) ;
263+
264+ assert . equal ( status , 200 , 'should respond with 200' ) ;
265+ assert . equal ( contentType , 'text/plain' , 'should respond with text/plain' ) ;
266+ assert . equal ( contentEncoding , null , 'should not respond with gzip encoding' ) ;
267+ assert . equal ( text , 'hello world' , 'should respond with hello world' ) ;
268+ } ) ;
269+
243270 it ( 'serves custom cache' , async function ( ) {
244271 const { response : responses /* , stdout */ } = await spawnConditional ( binFile , [
245272 '-p' , this . port , '--cache' , JSON . stringify ( {
0 commit comments