File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,7 @@ const headers2 = [
1313const myHeaders2 = new Headers ( headers2 ) ;
1414console . log ( "myHeaders2" , myHeaders2 ) ; // TODO Headers { 'Set-Cookie': 'greeting=hello, name=world' } but [object Object]
1515console . log ( "myHeaders" , myHeaders2 . get ( "Set-Cookie" ) ) ; // greeting=hellogreeting=hello,name=worldname=world
16+
17+ const myAppendHeader = new Headers ( ) ;
18+ myAppendHeader . append ( "Content-Type" , "image/jpeg" ) ;
19+ console . log ( "myAppendHeader" , myAppendHeader . get ( "Content-Type" ) ) ; // 'image/jpeg'
Original file line number Diff line number Diff line change @@ -15,9 +15,13 @@ class Headers {
1515
1616 // https://fetch.spec.whatwg.org/#dom-headers-get
1717 get ( name : string ) {
18- // @ts -ignore
1918 return getHeader ( this . headerList , name ) ;
2019 }
20+
21+ // https://fetch.spec.whatwg.org/#dom-headers-append
22+ append ( name , value ) {
23+ return appendHeader ( this , name , value ) ;
24+ }
2125}
2226
2327function fillHeaders ( headers : Headers , object ) {
You can’t perform that action at this time.
0 commit comments