Skip to content

Commit 5c9b100

Browse files
authored
Merge pull request #42 from stoplightio/fix/fetch-auth-headers
fix(http): allow for undefined headers
2 parents dd778ae + 9c852d0 commit 5c9b100

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/resolvers/http.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async function download (u, httpOptions, redirects) {
101101

102102
// Certain implementations of `fetch` do not support URL based basic-auth
103103
// Convert to headers
104-
const headers = new Headers(httpOptions.headers);
104+
const headers = new Headers(httpOptions.headers || {});
105105
if (u.auth && !headers.has("Authorization")) {
106106
headers.set("Authorization", "Basic " + btoa(u.auth));
107107
}
@@ -113,7 +113,7 @@ async function download (u, httpOptions, redirects) {
113113
/** @type {RequestInit} */
114114
const init = {
115115
method: "GET",
116-
headers: Object.fromEntries(headers.entries()),
116+
headers,
117117
credentials: httpOptions.withCredentials ? "include" : "omit",
118118
signal: controller.signal,
119119
// browser fetch API does not support redirects https://fetch.spec.whatwg.org/#atomic-http-redirect-handling

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/json-schema-ref-parser",
3-
"version": "9.2.3",
3+
"version": "9.2.4",
44
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
55
"keywords": [
66
"json",

0 commit comments

Comments
 (0)