@@ -492,6 +492,38 @@ describe('compression()', function(){
492492 } )
493493 } )
494494
495+ describe ( 'when "Cache-Control: no-transform" response header' , function ( ) {
496+ it ( 'should not compress response' , function ( done ) {
497+ var server = createServer ( { threshold : 0 } , function ( req , res ) {
498+ res . setHeader ( 'Cache-Control' , 'no-transform' )
499+ res . setHeader ( 'Content-Type' , 'text/plain' )
500+ res . end ( 'hello, world' )
501+ } )
502+
503+ request ( server )
504+ . get ( '/' )
505+ . set ( 'Accept-Encoding' , 'gzip' )
506+ . expect ( 'Cache-Control' , 'no-transform' )
507+ . expect ( shouldNotHaveHeader ( 'Content-Encoding' ) )
508+ . expect ( 200 , 'hello, world' , done )
509+ } )
510+
511+ it ( 'should not set Vary headerh' , function ( done ) {
512+ var server = createServer ( { threshold : 0 } , function ( req , res ) {
513+ res . setHeader ( 'Cache-Control' , 'no-transform' )
514+ res . setHeader ( 'Content-Type' , 'text/plain' )
515+ res . end ( 'hello, world' )
516+ } )
517+
518+ request ( server )
519+ . get ( '/' )
520+ . set ( 'Accept-Encoding' , 'gzip' )
521+ . expect ( 'Cache-Control' , 'no-transform' )
522+ . expect ( shouldNotHaveHeader ( 'Vary' ) )
523+ . expect ( 200 , done )
524+ } )
525+ } )
526+
495527 describe ( '.filter' , function ( ) {
496528 it ( 'should be a function' , function ( ) {
497529 assert . equal ( typeof compression . filter , 'function' )
0 commit comments