File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -549,6 +549,31 @@ describe('.middleware {MIDDLEWARE}', function() {
549549 } )
550550 } )
551551
552+ it ( 'revalidates cache when using header "x-apicache-revalidate"' , function ( done ) {
553+ var app = mockAPI . create ( '10 seconds' )
554+
555+ request ( app )
556+ . get ( '/api/movies' )
557+ . expect ( 200 , movies )
558+ . expect ( 'Cache-Control' , 'max-age=10' )
559+ . then ( assertNumRequestsProcessed ( app , 1 ) )
560+ . then ( function ( ) {
561+ setTimeout ( function ( ) {
562+ return request ( app )
563+ . get ( '/api/movies' )
564+ . set ( 'x-apicache-revalidate' , true )
565+ . expect ( 200 , movies )
566+ . expect ( 'Cache-Control' , 'max-age=10' )
567+ . then ( function ( res ) {
568+ expect ( res . headers [ 'apicache-store' ] ) . to . be . undefined
569+ expect ( res . headers [ 'apicache-version' ] ) . to . be . undefined
570+ expect ( app . requestsProcessed ) . to . equal ( 2 )
571+ done ( )
572+ } )
573+ } , 500 )
574+ } )
575+ } )
576+
552577 it ( 'does not cache header in headerBlacklist' , function ( ) {
553578 var app = mockAPI . create ( '10 seconds' , { headerBlacklist : [ 'x-blacklisted' ] } )
554579
You can’t perform that action at this time.
0 commit comments