@hyper-fetch/core 7.5.0 → 7.5.2

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.js CHANGED
@@ -2597,8 +2597,9 @@ var stringifyValue = (response) => {
2597
2597
  };
2598
2598
  var getAdapterHeaders = (request) => {
2599
2599
  const isFormData = hasWindow() && request.payload instanceof FormData;
2600
+ const isObject = typeof request.payload === "object" && request.payload !== null;
2600
2601
  const headers = {};
2601
- if (!isFormData) headers["Content-Type"] = "application/json";
2602
+ if (!isFormData && isObject) headers["Content-Type"] = "application/json";
2602
2603
  Object.assign(headers, request.headers);
2603
2604
  return headers;
2604
2605
  };
@@ -2986,8 +2987,9 @@ var getAdapter = () => new Adapter({
2986
2987
  onRequestProgress,
2987
2988
  onSuccess
2988
2989
  }) {
2989
- const { method, client, endpoint } = request;
2990
- const fullUrl = `${client.url}${endpoint}`;
2990
+ const { method, client, endpoint, queryParams } = request;
2991
+ const queryString = queryParams ? stringifyQueryParams(queryParams) : "";
2992
+ const fullUrl = `${client.url}${endpoint}${queryString}`;
2991
2993
  const xhr = new XMLHttpRequest();
2992
2994
  xhr.timeout = defaultTimeout;
2993
2995
  const onAbort = () => xhr.abort();
@@ -3061,7 +3063,7 @@ var getAdapter2 = () => new Adapter({
3061
3063
  onSuccess
3062
3064
  }) {
3063
3065
  var _a;
3064
- const { method, client, endpoint } = request;
3066
+ const { method, client, endpoint, queryParams } = request;
3065
3067
  const { url } = client;
3066
3068
  const httpClient = client.url.includes("https://") ? import_https.default : import_http3.default;
3067
3069
  const options = {
@@ -3079,7 +3081,8 @@ var getAdapter2 = () => new Adapter({
3079
3081
  if (payload) {
3080
3082
  options.headers["Content-Length"] = Buffer.byteLength(JSON.stringify(payload));
3081
3083
  }
3082
- const fullUrl = `${url}${endpoint}`;
3084
+ const queryString = queryParams ? stringifyQueryParams(queryParams) : "";
3085
+ const fullUrl = `${url}${endpoint}${queryString}`;
3083
3086
  const unmountListener = createAbortListener({
3084
3087
  status: 0,
3085
3088
  extra: xhrExtra