@axiom-lattice/client-sdk 2.1.63 → 2.1.64

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/dist/index.mjs CHANGED
@@ -3076,13 +3076,17 @@ var _Client = class extends AbstractClient {
3076
3076
  try {
3077
3077
  const fullUrl = url.startsWith("http") ? url : `${this.config.baseURL}${url}`;
3078
3078
  const workspaceHeaders = _Client.getWorkspaceHeaders();
3079
+ const mergedHeaders = {
3080
+ ...this.headers,
3081
+ ...workspaceHeaders,
3082
+ ...options.headers || {}
3083
+ };
3084
+ if (options.body instanceof FormData) {
3085
+ delete mergedHeaders["Content-Type"];
3086
+ }
3079
3087
  const response = await fetch(fullUrl, {
3080
3088
  ...options,
3081
- headers: {
3082
- ...this.headers,
3083
- ...workspaceHeaders,
3084
- ...options.headers || {}
3085
- },
3089
+ headers: mergedHeaders,
3086
3090
  signal: controller.signal
3087
3091
  });
3088
3092
  return await this.handleResponse(response);
@@ -3162,7 +3166,12 @@ var _Client = class extends AbstractClient {
3162
3166
  headers: requestHeaders
3163
3167
  };
3164
3168
  if (options?.body) {
3165
- requestOptions.body = JSON.stringify(options.body);
3169
+ if (options.body instanceof FormData) {
3170
+ requestOptions.body = options.body;
3171
+ delete requestHeaders["Content-Type"];
3172
+ } else {
3173
+ requestOptions.body = JSON.stringify(options.body);
3174
+ }
3166
3175
  }
3167
3176
  return this.fetchWithTimeout(url, requestOptions);
3168
3177
  }