@@ -200,6 +200,16 @@ describe('SuperHeaders', () => {
200
200
assert . equal ( headers . get ( 'Content-Disposition' ) , 'attachment; filename=example.txt' ) ;
201
201
} ) ;
202
202
203
+ it ( 'handles the contentEncoding property' , ( ) => {
204
+ let headers = new SuperHeaders ( { contentEncoding : 'gzip' } ) ;
205
+ assert . equal ( headers . get ( 'Content-Encoding' ) , 'gzip' ) ;
206
+ } ) ;
207
+
208
+ it ( 'handles the contentLanguage property' , ( ) => {
209
+ let headers = new SuperHeaders ( { contentLanguage : 'en-US' } ) ;
210
+ assert . equal ( headers . get ( 'Content-Language' ) , 'en-US' ) ;
211
+ } ) ;
212
+
203
213
it ( 'handles the contentLength property' , ( ) => {
204
214
let headers = new SuperHeaders ( { contentLength : 42 } ) ;
205
215
assert . equal ( headers . get ( 'Content-Length' ) , '42' ) ;
@@ -232,11 +242,6 @@ describe('SuperHeaders', () => {
232
242
assert . equal ( headers . get ( 'Host' ) , 'example.com' ) ;
233
243
} ) ;
234
244
235
- it ( 'handles the lastModified property' , ( ) => {
236
- let headers = new SuperHeaders ( { lastModified : new Date ( '2021-01-01T00:00:00Z' ) } ) ;
237
- assert . equal ( headers . get ( 'Last-Modified' ) , 'Fri, 01 Jan 2021 00:00:00 GMT' ) ;
238
- } ) ;
239
-
240
245
it ( 'handles the ifModifiedSince property' , ( ) => {
241
246
let headers = new SuperHeaders ( { ifModifiedSince : new Date ( '2021-01-01T00:00:00Z' ) } ) ;
242
247
assert . equal ( headers . get ( 'If-Modified-Since' ) , 'Fri, 01 Jan 2021 00:00:00 GMT' ) ;
@@ -247,6 +252,16 @@ describe('SuperHeaders', () => {
247
252
assert . equal ( headers . get ( 'If-Unmodified-Since' ) , 'Fri, 01 Jan 2021 00:00:00 GMT' ) ;
248
253
} ) ;
249
254
255
+ it ( 'handles the lastModified property' , ( ) => {
256
+ let headers = new SuperHeaders ( { lastModified : new Date ( '2021-01-01T00:00:00Z' ) } ) ;
257
+ assert . equal ( headers . get ( 'Last-Modified' ) , 'Fri, 01 Jan 2021 00:00:00 GMT' ) ;
258
+ } ) ;
259
+
260
+ it ( 'handles the location property' , ( ) => {
261
+ let headers = new SuperHeaders ( { location : 'https://example.com' } ) ;
262
+ assert . equal ( headers . get ( 'Location' ) , 'https://example.com' ) ;
263
+ } ) ;
264
+
250
265
it ( 'handles the referer property' , ( ) => {
251
266
let headers = new SuperHeaders ( { referer : 'https://example.com' } ) ;
252
267
assert . equal ( headers . get ( 'Referer' ) , 'https://example.com' ) ;
@@ -413,6 +428,36 @@ describe('SuperHeaders', () => {
413
428
assert . equal ( headers . contentDisposition . toString ( ) , '' ) ;
414
429
} ) ;
415
430
431
+ it ( 'supports the contentEncoding property' , ( ) => {
432
+ let headers = new SuperHeaders ( ) ;
433
+
434
+ assert . equal ( headers . contentEncoding , null ) ;
435
+
436
+ headers . contentEncoding = 'gzip' ;
437
+ assert . equal ( headers . contentEncoding , 'gzip' ) ;
438
+
439
+ headers . contentEncoding = [ 'deflate' , 'gzip' ] ;
440
+ assert . equal ( headers . contentEncoding , 'deflate, gzip' ) ;
441
+
442
+ headers . contentEncoding = null ;
443
+ assert . equal ( headers . contentEncoding , null ) ;
444
+ } ) ;
445
+
446
+ it ( 'supports the contentLanguage property' , ( ) => {
447
+ let headers = new SuperHeaders ( ) ;
448
+
449
+ assert . equal ( headers . contentLanguage , null ) ;
450
+
451
+ headers . contentLanguage = 'en-US' ;
452
+ assert . equal ( headers . contentLanguage , 'en-US' ) ;
453
+
454
+ headers . contentLanguage = [ 'en' , 'fr' ] ;
455
+ assert . equal ( headers . contentLanguage , 'en, fr' ) ;
456
+
457
+ headers . contentLanguage = null ;
458
+ assert . equal ( headers . contentLanguage , null ) ;
459
+ } ) ;
460
+
416
461
it ( 'supports the contentLength property' , ( ) => {
417
462
let headers = new SuperHeaders ( ) ;
418
463
@@ -506,19 +551,6 @@ describe('SuperHeaders', () => {
506
551
assert . equal ( headers . host , null ) ;
507
552
} ) ;
508
553
509
- it ( 'supports the lastModified property' , ( ) => {
510
- let headers = new SuperHeaders ( ) ;
511
-
512
- assert . equal ( headers . lastModified , null ) ;
513
-
514
- headers . lastModified = new Date ( '2021-01-01T00:00:00Z' ) ;
515
- assert . ok ( headers . lastModified instanceof Date ) ;
516
- assert . equal ( headers . lastModified . toUTCString ( ) , 'Fri, 01 Jan 2021 00:00:00 GMT' ) ;
517
-
518
- headers . lastModified = null ;
519
- assert . equal ( headers . lastModified , null ) ;
520
- } ) ;
521
-
522
554
it ( 'supports the ifModifiedSince property' , ( ) => {
523
555
let headers = new SuperHeaders ( ) ;
524
556
@@ -545,6 +577,31 @@ describe('SuperHeaders', () => {
545
577
assert . equal ( headers . ifUnmodifiedSince , null ) ;
546
578
} ) ;
547
579
580
+ it ( 'supports the lastModified property' , ( ) => {
581
+ let headers = new SuperHeaders ( ) ;
582
+
583
+ assert . equal ( headers . lastModified , null ) ;
584
+
585
+ headers . lastModified = new Date ( '2021-01-01T00:00:00Z' ) ;
586
+ assert . ok ( headers . lastModified instanceof Date ) ;
587
+ assert . equal ( headers . lastModified . toUTCString ( ) , 'Fri, 01 Jan 2021 00:00:00 GMT' ) ;
588
+
589
+ headers . lastModified = null ;
590
+ assert . equal ( headers . lastModified , null ) ;
591
+ } ) ;
592
+
593
+ it ( 'supports the location property' , ( ) => {
594
+ let headers = new SuperHeaders ( ) ;
595
+
596
+ assert . equal ( headers . location , null ) ;
597
+
598
+ headers . location = 'https://example.com' ;
599
+ assert . equal ( headers . location , 'https://example.com' ) ;
600
+
601
+ headers . location = null ;
602
+ assert . equal ( headers . location , null ) ;
603
+ } ) ;
604
+
548
605
it ( 'supports the referer property' , ( ) => {
549
606
let headers = new SuperHeaders ( ) ;
550
607
0 commit comments