apify-client 2.26.1-beta.0 → 2.26.1-beta.1

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/bundle.js CHANGED
@@ -14272,6 +14272,8 @@ const BUILD_NUMBER_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/;
14272
14272
  const authHeaders = {
14273
14273
  Authorization: null
14274
14274
  };
14275
+ // The fetch adapter adds a `User-Agent` of its own otherwise, which a browser lists in the CORS preflight.
14276
+ if (!(0,_utils__rspack_import_1.isNode)()) authHeaders['User-Agent'] = null;
14275
14277
  if (this.apifyClient.token) authHeaders['X-Apify-Authorization'] = `Bearer ${this.apifyClient.token}`;
14276
14278
  const requestHeaders = mergeHeaders(mergeHeaders(authHeaders, headers), parentRequestId === undefined ? undefined : {
14277
14279
  'X-Actor-Request-ID': parentRequestId
@@ -14291,7 +14293,14 @@ const BUILD_NUMBER_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/;
14291
14293
  };
14292
14294
  if (responseType === 'buffer') config.forceBuffer = true;
14293
14295
  if (responseType === 'stream') config.responseType = 'stream';
14294
- return this.httpClient.call(config);
14296
+ // The browser follows the redirects of an XHR itself, while the fetch adapter honors `maxRedirects: 0`.
14297
+ if (!(0,_utils__rspack_import_1.isNode)()) config.adapter = 'fetch';
14298
+ const response = await this.httpClient.call(config);
14299
+ // `redirect: 'manual'` resolves to an opaque response with status 0 instead of the redirect.
14300
+ if (!(0,_utils__rspack_import_1.isNode)() && response.status === 0) {
14301
+ throw new Error(`${method} ${config.url} responded with a redirect, which the client does not follow.`);
14302
+ }
14303
+ return response;
14295
14304
  }
14296
14305
  /**
14297
14306
  * Fetches the Actor, checks that it is a Server Actor, and caches its server URL.
@@ -18634,7 +18643,7 @@ function isStream(value) {
18634
18643
  function getVersionData() {
18635
18644
  if (true) {
18636
18645
  return {
18637
- version: "2.26.1-beta.0"
18646
+ version: "2.26.1-beta.1"
18638
18647
  };
18639
18648
  }
18640
18649
  // eslint-disable-next-line