Skip to content

Commit

Permalink
fix(http): allow for undefined headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel A. White committed May 4, 2023
1 parent dd778ae commit 9c852d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/resolvers/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function download (u, httpOptions, redirects) {

// Certain implementations of `fetch` do not support URL based basic-auth
// Convert to headers
const headers = new Headers(httpOptions.headers);
const headers = new Headers(httpOptions.headers || {});
if (u.auth && !headers.has("Authorization")) {
headers.set("Authorization", "Basic " + btoa(u.auth));
}
Expand All @@ -113,7 +113,7 @@ async function download (u, httpOptions, redirects) {
/** @type {RequestInit} */
const init = {
method: "GET",
headers: Object.fromEntries(headers.entries()),
headers,
credentials: httpOptions.withCredentials ? "include" : "omit",
signal: controller.signal,
// browser fetch API does not support redirects https://fetch.spec.whatwg.org/#atomic-http-redirect-handling
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stoplight/json-schema-ref-parser",
"version": "9.2.3",
"version": "9.2.4",
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
"keywords": [
"json",
Expand Down

0 comments on commit 9c852d0

Please sign in to comment.