File tree Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 12
12
13
13
strategy :
14
14
matrix :
15
- node-version : [18.x]
16
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
15
+ node-version : [18.x, 20.x ]
16
+ # See supported Node.js release schedule at https://nodejs.org/en/about/previous- releases
17
17
18
18
steps :
19
19
- uses : actions/checkout@v3
Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ such as injecting headers or adding log statements.
132
132
133
133
``` js
134
134
replicate .fetch = (url , options ) => {
135
- const headers = new Headers ( options && options .headers ) ;
136
- headers . append ( " X-Custom-Header" , " some value" ) ;
135
+ const headers = options && options .headers ? { ... options . headers } : {} ;
136
+ headers[ " X-Custom-Header" ] = " some value" ;
137
137
138
138
console .log (" fetch" , { url, ... options, headers });
139
139
Original file line number Diff line number Diff line change 17
17
"useMediaCaption" : " off" ,
18
18
"noSvgWithoutTitle" : " off"
19
19
},
20
+ "complexity" : {
21
+ "useLiteralKeys" : " off" ,
22
+ "useOptionalChain" : " off"
23
+ },
20
24
"performance" : {
21
25
"noAccumulatingSpread" : " off"
22
26
},
23
27
"suspicious" : {
24
28
"noArrayIndexKey" : " off" ,
25
29
"noExplicitAny" : " off"
26
- },
27
- "complexity" : {
28
- "useOptionalChain" : " off"
29
30
}
30
31
}
31
32
}
Original file line number Diff line number Diff line change @@ -191,15 +191,15 @@ class Replicate {
191
191
url . searchParams . append ( key , value ) ;
192
192
}
193
193
194
- const headers = new Headers ( ) ;
194
+ const headers = { } ;
195
195
if ( auth ) {
196
- headers . append ( "Authorization" , `Token ${ auth } ` ) ;
196
+ headers [ "Authorization" ] = `Token ${ auth } ` ;
197
197
}
198
- headers . append ( "Content-Type" , "application/json" ) ;
199
- headers . append ( "User-Agent" , userAgent ) ;
198
+ headers [ "Content-Type" ] = "application/json" ;
199
+ headers [ "User-Agent" ] = userAgent ;
200
200
if ( options . headers ) {
201
- for ( const [ key , value ] of options . headers . entries ( ) ) {
202
- headers . append ( key , value ) ;
201
+ for ( const [ key , value ] of Object . entries ( options . headers ) ) {
202
+ headers [ key ] = value ;
203
203
}
204
204
}
205
205
You can’t perform that action at this time.
0 commit comments