File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,12 @@ export const core: Wretch = {
4949 return { ...this , _options : replace ? options : mix ( this . _options , options ) }
5050 } ,
5151 headers ( headerValues ) {
52- return { ...this , _options : mix ( this . _options , { headers : headerValues || { } } ) }
52+ const headers =
53+ ! headerValues ? { } :
54+ Array . isArray ( headerValues ) ? Object . fromEntries ( headerValues ) :
55+ "entries" in headerValues ? Object . fromEntries ( ( headerValues as Headers ) . entries ( ) ) :
56+ headerValues
57+ return { ...this , _options : mix ( this . _options , { headers } ) }
5358 } ,
5459 accept ( headerValue ) {
5560 return this . headers ( { Accept : headerValue } )
Original file line number Diff line number Diff line change 11import { CONTENT_TYPE_HEADER } from "./constants.js"
22
3- export function extractContentType ( headers : HeadersInit = { } ) : string | undefined {
3+ export function extractContentType ( headers : Record < string , string > = { } ) : string | undefined {
44 return Object . entries ( headers ) . find ( ( [ k ] ) =>
55 k . toLowerCase ( ) === CONTENT_TYPE_HEADER . toLowerCase ( )
66 ) ?. [ 1 ]
Original file line number Diff line number Diff line change 33 "target" : " es5" ,
44 "lib" : [
55 " es2015" ,
6- " dom"
6+ " dom" ,
7+ " dom.iterable"
78 ],
89 "module" : " commonjs" ,
910 "noImplicitAny" : false ,
1718 "include" : [
1819 " ./node/**/*.spec.ts"
1920 ]
20- }
21+ }
Original file line number Diff line number Diff line change 33 "target" : " ES2018" ,
44 "lib" : [
55 " es2020" ,
6- " dom"
6+ " dom" ,
7+ " dom.iterable"
78 ],
89 "module" : " es2015" ,
910 "outDir" : " dist" ,
1920 " src/**/*" ,
2021 " test.ts"
2122 ]
22- }
23+ }
You can’t perform that action at this time.
0 commit comments