@wise/dynamic-flow-client 3.11.2-experimental-7d4fc19 → 3.11.2-experimental-26093dd

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.
package/build/main.mjs CHANGED
@@ -290,42 +290,21 @@ var makeHttpClient = (baseUrl, additionalHeaders) => (
290
290
  // eslint-disable-next-line @typescript-eslint/promise-function-async
291
291
  (input, init) => {
292
292
  const resource = applyBaseUrl(input, baseUrl || "");
293
- const requestInit = mergeRequestInit(init != null ? init : {}, { headers: additionalHeaders });
294
- const requestHeaders = requestInit.headers;
295
- return fetch(resource, requestInit).then((response) => {
296
- if (response.status === 415) {
297
- console.warn(
298
- `DF request to ${String(resource)} failed with status 415. Request headers: ${stringifyHeadersInit(requestHeaders)}`
299
- );
300
- }
301
- return response;
302
- });
293
+ return fetch(resource, mergeRequestInit(init != null ? init : {}, { headers: additionalHeaders }));
303
294
  }
304
295
  );
305
296
  var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
306
297
  var mergeRequestInit = (init, additionalInit) => __spreadProps(__spreadValues(__spreadValues({}, init), additionalInit), {
307
- headers: mergeHeaders(init == null ? void 0 : init.headers, additionalInit == null ? void 0 : additionalInit.headers)
298
+ // initHeaders takes priority over additionalHeaders, so must come last!
299
+ // DF Core knows what content-type it's requesting (often JSON, sometimes images)
300
+ // so we should trust the init headers instead of the additionalInit headers from
301
+ // when the httpClient is created.
302
+ headers: mergeHeaders(additionalInit == null ? void 0 : additionalInit.headers, init == null ? void 0 : init.headers)
308
303
  });
309
304
  var mergeHeaders = (...headersInits) => headersInits.reduce(
310
305
  (acc, headers2) => __spreadValues(__spreadValues({}, acc), Object.fromEntries(new Headers(headers2).entries())),
311
306
  {}
312
307
  );
313
- var stringifyHeadersInit = (headersInit) => {
314
- if (headersInit === void 0) {
315
- return "undefined";
316
- }
317
- if (headersInit === null) {
318
- return "null";
319
- }
320
- if (headersInit instanceof Headers) {
321
- const entries = Array.from(headersInit.entries());
322
- return `(Headers instance) ${JSON.stringify(entries)}`;
323
- }
324
- if (Array.isArray(headersInit)) {
325
- return `(Array) ${JSON.stringify(headersInit)}`;
326
- }
327
- return `(Object) ${JSON.stringify(headersInit)}`;
328
- };
329
308
 
330
309
  // src/i18n/de.json
331
310
  var de_default = {
@@ -19050,7 +19029,9 @@ var DynamicFlowComponent = ({
19050
19029
  const { url, method = "POST" } = action;
19051
19030
  return httpClient(url != null ? url : "", {
19052
19031
  method,
19053
- headers: __spreadValues({}, etag2 ? { "If-None-Match": etag2 } : {}),
19032
+ headers: __spreadValues({
19033
+ "Content-Type": "application/json"
19034
+ }, etag2 ? { "If-None-Match": etag2 } : {}),
19054
19035
  body: method === "GET" ? void 0 : JSON.stringify(data)
19055
19036
  });
19056
19037
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "3.11.2-experimental-7d4fc19",
3
+ "version": "3.11.2-experimental-26093dd",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",