1- var request = require ( 'supertest' ) ;
2- var koa = require ( 'koa' ) ;
3- var cacheControl = require ( '..' ) ;
4- var fs = require ( 'fs' ) ;
1+ const request = require ( 'supertest' ) ;
2+ const koa = require ( 'koa' ) ;
3+ const cacheControl = require ( '..' ) ;
4+ const fs = require ( 'fs' ) ;
55
66describe ( 'cacheControl()' , function ( ) {
77 describe ( 'default configuration' , function ( ) {
88 it ( 'uses defaults if nothing defined on request' , function ( done ) {
9- var app = new koa ( ) ;
9+ const app = new koa ( ) ;
1010
1111 app . use ( cacheControl ( {
1212 maxAge : 4
@@ -25,7 +25,7 @@ describe('cacheControl()', function () {
2525
2626 describe ( 'override default configuration' , function ( ) {
2727 it ( 'allows middleware to override options in incoming requests' , function ( done ) {
28- var app = new koa ( ) ;
28+ const app = new koa ( ) ;
2929
3030 app . use ( cacheControl ( {
3131 maxAge : 4
@@ -46,7 +46,7 @@ describe('cacheControl()', function () {
4646 } )
4747
4848 it ( 'allows middleware to override options on outgoing requests' , function ( done ) {
49- var app = new koa ( ) ;
49+ const app = new koa ( ) ;
5050
5151 app . use ( cacheControl ( {
5252 maxAge : 300
@@ -73,7 +73,7 @@ describe('cacheControl()', function () {
7373
7474 describe ( 'public is set' , function ( ) {
7575 it ( 'adds public flag to cache-control header' , function ( done ) {
76- var app = new koa ( ) ;
76+ const app = new koa ( ) ;
7777
7878 app . use ( cacheControl ( {
7979 public : true
@@ -92,7 +92,7 @@ describe('cacheControl()', function () {
9292
9393 describe ( 'private is set' , function ( ) {
9494 it ( 'adds private flag to cache-control header' , function ( done ) {
95- var app = new koa ( ) ;
95+ const app = new koa ( ) ;
9696
9797 app . use ( cacheControl ( {
9898 private : true
@@ -109,7 +109,7 @@ describe('cacheControl()', function () {
109109 } ) ;
110110
111111 it ( 'discards public flag in cache-control header' , function ( done ) {
112- var app = new koa ( ) ;
112+ const app = new koa ( ) ;
113113
114114 app . use ( cacheControl ( {
115115 private : true ,
@@ -129,7 +129,7 @@ describe('cacheControl()', function () {
129129
130130 describe ( 'maxAge is set' , function ( ) {
131131 it ( 'sets cache-control max-age section' , function ( done ) {
132- var app = new koa ( ) ;
132+ const app = new koa ( ) ;
133133
134134 app . use ( cacheControl ( {
135135 maxAge : 4
@@ -148,7 +148,7 @@ describe('cacheControl()', function () {
148148
149149 describe ( 'staleIfError is set' , function ( ) {
150150 it ( 'sets cache-control header with stale-if-error' , function ( done ) {
151- var app = new koa ( ) ;
151+ const app = new koa ( ) ;
152152
153153 app . use ( cacheControl ( {
154154 staleIfError : 320
@@ -167,7 +167,7 @@ describe('cacheControl()', function () {
167167
168168 describe ( 'staleWhileRevalidate is set' , function ( ) {
169169 it ( 'sets cache-control header with stale-while-revalidate' , function ( done ) {
170- var app = new koa ( ) ;
170+ const app = new koa ( ) ;
171171
172172 app . use ( cacheControl ( {
173173 staleWhileRevalidate : 320
@@ -186,7 +186,7 @@ describe('cacheControl()', function () {
186186
187187 describe ( 'mustRevalidate is set' , function ( ) {
188188 it ( 'sets cache-control header with must-revalidate' , function ( done ) {
189- var app = new koa ( ) ;
189+ const app = new koa ( ) ;
190190
191191 app . use ( cacheControl ( {
192192 mustRevalidate : true
@@ -203,7 +203,7 @@ describe('cacheControl()', function () {
203203 } ) ;
204204
205205 it ( 'overthrows stale-while-revalidate and stale-if-error' , function ( done ) {
206- var app = new koa ( ) ;
206+ const app = new koa ( ) ;
207207
208208 app . use ( cacheControl ( {
209209 mustRevalidate : true ,
@@ -224,7 +224,7 @@ describe('cacheControl()', function () {
224224
225225 describe ( 'when noCache is true' , function ( ) {
226226 it ( 'adds no-cache to Cache-Control header' , function ( done ) {
227- var app = new koa ( ) ;
227+ const app = new koa ( ) ;
228228
229229 app . use ( cacheControl ( {
230230 noCache : true
@@ -241,7 +241,7 @@ describe('cacheControl()', function () {
241241 } ) ;
242242
243243 it ( 'sets maxAge to 0' , function ( done ) {
244- var app = new koa ( ) ;
244+ const app = new koa ( ) ;
245245
246246 app . use ( cacheControl ( {
247247 noCache : true ,
@@ -259,7 +259,7 @@ describe('cacheControl()', function () {
259259 } ) ;
260260
261261 it ( 'removes sMaxAge' , function ( done ) {
262- var app = new koa ( ) ;
262+ const app = new koa ( ) ;
263263
264264 app . use ( cacheControl ( {
265265 noCache : true ,
@@ -277,7 +277,7 @@ describe('cacheControl()', function () {
277277 } ) ;
278278
279279 it ( 'ignores stale settings' , function ( done ) {
280- var app = new koa ( ) ;
280+ const app = new koa ( ) ;
281281
282282 app . use ( cacheControl ( {
283283 noCache : true ,
@@ -298,7 +298,7 @@ describe('cacheControl()', function () {
298298
299299 describe ( 'when noStore is true' , function ( ) {
300300 it ( 'sets Cache-Control no-store and no-cache' , function ( done ) {
301- var app = new koa ( ) ;
301+ const app = new koa ( ) ;
302302
303303 app . use ( cacheControl ( {
304304 noStore : true
@@ -315,7 +315,7 @@ describe('cacheControl()', function () {
315315 } ) ;
316316
317317 it ( 'sets maxAge to 0' , function ( done ) {
318- var app = new koa ( ) ;
318+ const app = new koa ( ) ;
319319
320320 app . use ( cacheControl ( {
321321 noStore : true ,
@@ -335,7 +335,7 @@ describe('cacheControl()', function () {
335335
336336 describe ( 'when noTransform is set' , function ( ) {
337337 it ( 'sets Cache-Control no-transform' , function ( done ) {
338- var app = new koa ( ) ;
338+ const app = new koa ( ) ;
339339
340340 app . use ( cacheControl ( {
341341 noTransform : true
@@ -354,7 +354,7 @@ describe('cacheControl()', function () {
354354
355355 describe ( 'when proxyRevalidate' , function ( ) {
356356 it ( 'sets Cache-Control proxy-revalidate' , function ( done ) {
357- var app = new koa ( ) ;
357+ const app = new koa ( ) ;
358358
359359 app . use ( cacheControl ( {
360360 proxyRevalidate : true
@@ -374,7 +374,7 @@ describe('cacheControl()', function () {
374374
375375 describe ( 'when sMaxAge' , function ( ) {
376376 it ( 'sets Cache-Control s-maxage property' , function ( done ) {
377- var app = new koa ( ) ;
377+ const app = new koa ( ) ;
378378
379379 app . use ( cacheControl ( {
380380 sMaxAge : 10
@@ -393,7 +393,7 @@ describe('cacheControl()', function () {
393393
394394 describe ( 'when no cache properties set' , function ( ) {
395395 it ( 'does not set a cache-control header' , function ( done ) {
396- var app = new koa ( ) ;
396+ const app = new koa ( ) ;
397397
398398 app . use ( cacheControl ( ) ) ;
399399
0 commit comments