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 1212
1313 strategy :
1414 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
1717
1818 steps :
1919 - 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.
132132
133133``` js
134134replicate .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" ;
137137
138138 console .log (" fetch" , { url, ... options, headers });
139139
Original file line number Diff line number Diff line change 1717 "useMediaCaption" : " off" ,
1818 "noSvgWithoutTitle" : " off"
1919 },
20+ "complexity" : {
21+ "useLiteralKeys" : " off" ,
22+ "useOptionalChain" : " off"
23+ },
2024 "performance" : {
2125 "noAccumulatingSpread" : " off"
2226 },
2327 "suspicious" : {
2428 "noArrayIndexKey" : " off" ,
2529 "noExplicitAny" : " off"
26- },
27- "complexity" : {
28- "useOptionalChain" : " off"
2930 }
3031 }
3132 }
Original file line number Diff line number Diff line change @@ -191,15 +191,15 @@ class Replicate {
191191 url . searchParams . append ( key , value ) ;
192192 }
193193
194- const headers = new Headers ( ) ;
194+ const headers = { } ;
195195 if ( auth ) {
196- headers . append ( "Authorization" , `Token ${ auth } ` ) ;
196+ headers [ "Authorization" ] = `Token ${ auth } ` ;
197197 }
198- headers . append ( "Content-Type" , "application/json" ) ;
199- headers . append ( "User-Agent" , userAgent ) ;
198+ headers [ "Content-Type" ] = "application/json" ;
199+ headers [ "User-Agent" ] = userAgent ;
200200 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 ;
203203 }
204204 }
205205
You can’t perform that action at this time.
0 commit comments