@comunica/actor-http-fetch 2.4.0 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,8 +26,8 @@ class ActorHttpFetch extends bus_http_1.ActorHttp {
26
26
  }
27
27
  async run(action) {
28
28
  // Prepare headers
29
- const initHeaders = action.init ? action.init.headers || {} : {};
30
- action.init = action.init ? action.init : {};
29
+ const initHeaders = action.init?.headers ?? {};
30
+ action.init = action.init ?? {};
31
31
  action.init.headers = new Headers(initHeaders);
32
32
  if (!action.init.headers.has('user-agent')) {
33
33
  action.init.headers.append('user-agent', this.userAgent);
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ /* eslint-disable unicorn/filename-case */
3
+ /* eslint-enable unicorn/filename-case */
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  exports.FetchInitPreprocessor = void 0;
6
+ const bus_http_1 = require("@comunica/bus-http");
4
7
  /**
5
8
  * Overrides things for fetch requests in browsers
6
9
  */
@@ -14,6 +17,10 @@ class FetchInitPreprocessor {
14
17
  }
15
18
  init.headers = headers;
16
19
  }
20
+ // TODO: remove this workaround once this has a fix: https://github.com/inrupt/solid-client-authn-js/issues/1708
21
+ if (init?.headers && 'append' in init.headers) {
22
+ init.headers = bus_http_1.ActorHttp.headersToHash(init.headers);
23
+ }
17
24
  // Browsers don't yet support passing ReadableStream as body to requests, see
18
25
  // https://bugs.chromium.org/p/chromium/issues/detail?id=688906
19
26
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1387483
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-http-fetch",
3
- "version": "2.4.0",
3
+ "version": "2.4.3",
4
4
  "description": "A node-fetch http actor",
5
5
  "lsd:module": true,
6
6
  "main": "lib/index.js",
@@ -43,5 +43,5 @@
43
43
  "browser": {
44
44
  "./lib/FetchInitPreprocessor.js": "./lib/FetchInitPreprocessor-browser.js"
45
45
  },
46
- "gitHead": "cb5a1560c9ab9ebaf3335888a1411a7e1654de1e"
46
+ "gitHead": "8d1e8773e976da66eefbe224f5ffa19e81614ebc"
47
47
  }