@@ -25,8 +25,7 @@ import Headers from '@mjackson/headers';
25
25
let headers = new Headers ();
26
26
27
27
// Accept
28
- headers .accept = { ' text/html' : 1 , ' text/*' : 0.9 };
29
- // or headers.accept = 'text/html,text/*;q=0.9';
28
+ headers .accept = ' text/html, text/*;q=0.9' ;
30
29
31
30
headers .accept .mediaTypes ; // [ 'text/html', 'text/*' ]
32
31
Object .fromEntries (headers .accept .entries ()); // { 'text/html': 1, 'text/*': 0.9 }
@@ -43,17 +42,15 @@ headers.accept.set('text/*', 0.8);
43
42
headers .get (' Accept' ); // 'text/html,text/plain;q=0.9,text/*;q=0.8'
44
43
45
44
// Accept-Encoding
46
- headers .acceptEncoding = { gzip: 1 , deflate: 0.8 };
47
- // or headers.acceptEncoding = 'gzip, deflate;q=0.8';
45
+ headers .acceptEncoding = ' gzip, deflate;q=0.8' ;
48
46
49
47
headers .acceptEncoding .accepts (' gzip' ); // true
50
48
headers .acceptEncoding .accepts (' br' ); // false
51
49
52
50
headers .acceptEncoding .getPreferred ([' gzip' , ' deflate' ]); // 'gzip'
53
51
54
52
// Accept-Language
55
- headers .acceptLanguage = { ' en-US' : 1 , en: 0.9 };
56
- // or headers.acceptLanguage = 'en-US,en;q=0.9';
53
+ headers .acceptLanguage = ' en-US, en;q=0.9' ;
57
54
58
55
headers .acceptLanguage .languages ; // [ 'en-us', 'en' ]
59
56
Object .fromEntries (headers .acceptLanguage .entries ()); // { 'en-us': 1, en: 0.9 }
0 commit comments