Skip to content

Commit ff14f07

Browse files
committed
fix(nixify): set Accept header when responseType is JSON
1 parent 95053a5 commit ff14f07

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/nixify.ts

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const _request = (config): Request => {
3030
throw new TypeError(`Unsupported protocol, ${config.url.protocol}`)
3131
}
3232

33+
// if .json() is set by default add Accept header
34+
config.responseType === "json" && !config.headers.has("Accept")
35+
? config.headers.set("Accept", responseTypes.json)
36+
: undefined
37+
3338
const request = filterRequestOptions(config)
3439

3540
return new Request(config.url.toString(), request)

0 commit comments

Comments
 (0)