rezo 1.0.12 → 1.0.13

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.
@@ -1,5 +1,5 @@
1
- const _mod_rnh6oq = require('../plugin/crawler.cjs');
2
- exports.Crawler = _mod_rnh6oq.Crawler;;
3
- const _mod_7z7l7f = require('../plugin/crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_7z7l7f.CrawlerOptions;
5
- exports.Domain = _mod_7z7l7f.Domain;;
1
+ const _mod_m9euun = require('../plugin/crawler.cjs');
2
+ exports.Crawler = _mod_m9euun.Crawler;;
3
+ const _mod_358g2f = require('../plugin/crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_358g2f.CrawlerOptions;
5
+ exports.Domain = _mod_358g2f.Domain;;
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
- const _mod_jr843j = require('./core/rezo.cjs');
2
- exports.Rezo = _mod_jr843j.Rezo;
3
- exports.createRezoInstance = _mod_jr843j.createRezoInstance;
4
- exports.createDefaultInstance = _mod_jr843j.createDefaultInstance;;
5
- const _mod_tk44ak = require('./errors/rezo-error.cjs');
6
- exports.RezoError = _mod_tk44ak.RezoError;
7
- exports.RezoErrorCode = _mod_tk44ak.RezoErrorCode;;
8
- const _mod_n1xwl0 = require('./utils/headers.cjs');
9
- exports.RezoHeaders = _mod_n1xwl0.RezoHeaders;;
10
- const _mod_ci344r = require('./utils/form-data.cjs');
11
- exports.RezoFormData = _mod_ci344r.RezoFormData;;
12
- const _mod_611jzw = require('./utils/cookies.cjs');
13
- exports.RezoCookieJar = _mod_611jzw.RezoCookieJar;
14
- exports.Cookie = _mod_611jzw.Cookie;;
15
- const _mod_7h5jew = require('./core/hooks.cjs');
16
- exports.createDefaultHooks = _mod_7h5jew.createDefaultHooks;
17
- exports.mergeHooks = _mod_7h5jew.mergeHooks;;
18
- const _mod_0rf8qu = require('./proxy/manager.cjs');
19
- exports.ProxyManager = _mod_0rf8qu.ProxyManager;;
20
- const _mod_ho3aaq = require('./queue/index.cjs');
21
- exports.RezoQueue = _mod_ho3aaq.RezoQueue;
22
- exports.HttpQueue = _mod_ho3aaq.HttpQueue;
23
- exports.Priority = _mod_ho3aaq.Priority;
24
- exports.HttpMethodPriority = _mod_ho3aaq.HttpMethodPriority;;
1
+ const _mod_txkkmz = require('./core/rezo.cjs');
2
+ exports.Rezo = _mod_txkkmz.Rezo;
3
+ exports.createRezoInstance = _mod_txkkmz.createRezoInstance;
4
+ exports.createDefaultInstance = _mod_txkkmz.createDefaultInstance;;
5
+ const _mod_a3vsp1 = require('./errors/rezo-error.cjs');
6
+ exports.RezoError = _mod_a3vsp1.RezoError;
7
+ exports.RezoErrorCode = _mod_a3vsp1.RezoErrorCode;;
8
+ const _mod_2ef980 = require('./utils/headers.cjs');
9
+ exports.RezoHeaders = _mod_2ef980.RezoHeaders;;
10
+ const _mod_e56bdp = require('./utils/form-data.cjs');
11
+ exports.RezoFormData = _mod_e56bdp.RezoFormData;;
12
+ const _mod_ss7zpn = require('./utils/cookies.cjs');
13
+ exports.RezoCookieJar = _mod_ss7zpn.RezoCookieJar;
14
+ exports.Cookie = _mod_ss7zpn.Cookie;;
15
+ const _mod_vdi6fa = require('./core/hooks.cjs');
16
+ exports.createDefaultHooks = _mod_vdi6fa.createDefaultHooks;
17
+ exports.mergeHooks = _mod_vdi6fa.mergeHooks;;
18
+ const _mod_049k4s = require('./proxy/manager.cjs');
19
+ exports.ProxyManager = _mod_049k4s.ProxyManager;;
20
+ const _mod_5l0v67 = require('./queue/index.cjs');
21
+ exports.RezoQueue = _mod_5l0v67.RezoQueue;
22
+ exports.HttpQueue = _mod_5l0v67.HttpQueue;
23
+ exports.Priority = _mod_5l0v67.Priority;
24
+ exports.HttpMethodPriority = _mod_5l0v67.HttpMethodPriority;;
25
25
  const { RezoError } = require('./errors/rezo-error.cjs');
26
26
  const isRezoError = exports.isRezoError = RezoError.isRezoError;
27
27
  const Cancel = exports.Cancel = RezoError;
@@ -1,36 +1,36 @@
1
- const _mod_a9kn57 = require('./crawler.cjs');
2
- exports.Crawler = _mod_a9kn57.Crawler;;
3
- const _mod_6ccm6s = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_6ccm6s.CrawlerOptions;;
5
- const _mod_7naagm = require('../cache/file-cacher.cjs');
6
- exports.FileCacher = _mod_7naagm.FileCacher;;
7
- const _mod_22i2ua = require('../cache/url-store.cjs');
8
- exports.UrlStore = _mod_22i2ua.UrlStore;;
9
- const _mod_37jf5t = require('./addon/oxylabs/index.cjs');
10
- exports.Oxylabs = _mod_37jf5t.Oxylabs;;
11
- const _mod_u1lbrx = require('./addon/oxylabs/options.cjs');
12
- exports.OXYLABS_BROWSER_TYPES = _mod_u1lbrx.OXYLABS_BROWSER_TYPES;
13
- exports.OXYLABS_COMMON_LOCALES = _mod_u1lbrx.OXYLABS_COMMON_LOCALES;
14
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_u1lbrx.OXYLABS_COMMON_GEO_LOCATIONS;
15
- exports.OXYLABS_US_STATES = _mod_u1lbrx.OXYLABS_US_STATES;
16
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_u1lbrx.OXYLABS_EUROPEAN_COUNTRIES;
17
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_u1lbrx.OXYLABS_ASIAN_COUNTRIES;
18
- exports.getRandomOxylabsBrowserType = _mod_u1lbrx.getRandomBrowserType;
19
- exports.getRandomOxylabsLocale = _mod_u1lbrx.getRandomLocale;
20
- exports.getRandomOxylabsGeoLocation = _mod_u1lbrx.getRandomGeoLocation;;
21
- const _mod_mozpwt = require('./addon/decodo/index.cjs');
22
- exports.Decodo = _mod_mozpwt.Decodo;;
23
- const _mod_g6f0a3 = require('./addon/decodo/options.cjs');
24
- exports.DECODO_DEVICE_TYPES = _mod_g6f0a3.DECODO_DEVICE_TYPES;
25
- exports.DECODO_HEADLESS_MODES = _mod_g6f0a3.DECODO_HEADLESS_MODES;
26
- exports.DECODO_COMMON_LOCALES = _mod_g6f0a3.DECODO_COMMON_LOCALES;
27
- exports.DECODO_COMMON_COUNTRIES = _mod_g6f0a3.DECODO_COMMON_COUNTRIES;
28
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_g6f0a3.DECODO_EUROPEAN_COUNTRIES;
29
- exports.DECODO_ASIAN_COUNTRIES = _mod_g6f0a3.DECODO_ASIAN_COUNTRIES;
30
- exports.DECODO_US_STATES = _mod_g6f0a3.DECODO_US_STATES;
31
- exports.DECODO_COMMON_CITIES = _mod_g6f0a3.DECODO_COMMON_CITIES;
32
- exports.getRandomDecodoDeviceType = _mod_g6f0a3.getRandomDeviceType;
33
- exports.getRandomDecodoLocale = _mod_g6f0a3.getRandomLocale;
34
- exports.getRandomDecodoCountry = _mod_g6f0a3.getRandomCountry;
35
- exports.getRandomDecodoCity = _mod_g6f0a3.getRandomCity;
36
- exports.generateDecodoSessionId = _mod_g6f0a3.generateSessionId;;
1
+ const _mod_dq9ozb = require('./crawler.cjs');
2
+ exports.Crawler = _mod_dq9ozb.Crawler;;
3
+ const _mod_d0jsak = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_d0jsak.CrawlerOptions;;
5
+ const _mod_wbhzam = require('../cache/file-cacher.cjs');
6
+ exports.FileCacher = _mod_wbhzam.FileCacher;;
7
+ const _mod_ic6xnp = require('../cache/url-store.cjs');
8
+ exports.UrlStore = _mod_ic6xnp.UrlStore;;
9
+ const _mod_u5fn2x = require('./addon/oxylabs/index.cjs');
10
+ exports.Oxylabs = _mod_u5fn2x.Oxylabs;;
11
+ const _mod_mc3i9t = require('./addon/oxylabs/options.cjs');
12
+ exports.OXYLABS_BROWSER_TYPES = _mod_mc3i9t.OXYLABS_BROWSER_TYPES;
13
+ exports.OXYLABS_COMMON_LOCALES = _mod_mc3i9t.OXYLABS_COMMON_LOCALES;
14
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_mc3i9t.OXYLABS_COMMON_GEO_LOCATIONS;
15
+ exports.OXYLABS_US_STATES = _mod_mc3i9t.OXYLABS_US_STATES;
16
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_mc3i9t.OXYLABS_EUROPEAN_COUNTRIES;
17
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_mc3i9t.OXYLABS_ASIAN_COUNTRIES;
18
+ exports.getRandomOxylabsBrowserType = _mod_mc3i9t.getRandomBrowserType;
19
+ exports.getRandomOxylabsLocale = _mod_mc3i9t.getRandomLocale;
20
+ exports.getRandomOxylabsGeoLocation = _mod_mc3i9t.getRandomGeoLocation;;
21
+ const _mod_d70cyo = require('./addon/decodo/index.cjs');
22
+ exports.Decodo = _mod_d70cyo.Decodo;;
23
+ const _mod_cmnvxg = require('./addon/decodo/options.cjs');
24
+ exports.DECODO_DEVICE_TYPES = _mod_cmnvxg.DECODO_DEVICE_TYPES;
25
+ exports.DECODO_HEADLESS_MODES = _mod_cmnvxg.DECODO_HEADLESS_MODES;
26
+ exports.DECODO_COMMON_LOCALES = _mod_cmnvxg.DECODO_COMMON_LOCALES;
27
+ exports.DECODO_COMMON_COUNTRIES = _mod_cmnvxg.DECODO_COMMON_COUNTRIES;
28
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_cmnvxg.DECODO_EUROPEAN_COUNTRIES;
29
+ exports.DECODO_ASIAN_COUNTRIES = _mod_cmnvxg.DECODO_ASIAN_COUNTRIES;
30
+ exports.DECODO_US_STATES = _mod_cmnvxg.DECODO_US_STATES;
31
+ exports.DECODO_COMMON_CITIES = _mod_cmnvxg.DECODO_COMMON_CITIES;
32
+ exports.getRandomDecodoDeviceType = _mod_cmnvxg.getRandomDeviceType;
33
+ exports.getRandomDecodoLocale = _mod_cmnvxg.getRandomLocale;
34
+ exports.getRandomDecodoCountry = _mod_cmnvxg.getRandomCountry;
35
+ exports.getRandomDecodoCity = _mod_cmnvxg.getRandomCity;
36
+ exports.generateDecodoSessionId = _mod_cmnvxg.generateSessionId;;
@@ -1,8 +1,8 @@
1
1
  const { SocksProxyAgent: RezoSocksProxy } = require("socks-proxy-agent");
2
2
  const { HttpsProxyAgent: RezoHttpsSocks } = require("https-proxy-agent");
3
3
  const { HttpProxyAgent: RezoHttpSocks } = require("http-proxy-agent");
4
- const _mod_448ob0 = require('./manager.cjs');
5
- exports.ProxyManager = _mod_448ob0.ProxyManager;;
4
+ const _mod_p28kf5 = require('./manager.cjs');
5
+ exports.ProxyManager = _mod_p28kf5.ProxyManager;;
6
6
  function createOptions(uri, opts) {
7
7
  if (uri instanceof URL || typeof uri === "string") {
8
8
  return {
@@ -1,8 +1,8 @@
1
- const _mod_ipfe1q = require('./queue.cjs');
2
- exports.RezoQueue = _mod_ipfe1q.RezoQueue;;
3
- const _mod_sc99zf = require('./http-queue.cjs');
4
- exports.HttpQueue = _mod_sc99zf.HttpQueue;
5
- exports.extractDomain = _mod_sc99zf.extractDomain;;
6
- const _mod_4akyyt = require('./types.cjs');
7
- exports.Priority = _mod_4akyyt.Priority;
8
- exports.HttpMethodPriority = _mod_4akyyt.HttpMethodPriority;;
1
+ const _mod_5bxokv = require('./queue.cjs');
2
+ exports.RezoQueue = _mod_5bxokv.RezoQueue;;
3
+ const _mod_12mknl = require('./http-queue.cjs');
4
+ exports.HttpQueue = _mod_12mknl.HttpQueue;
5
+ exports.extractDomain = _mod_12mknl.extractDomain;;
6
+ const _mod_u9vq92 = require('./types.cjs');
7
+ exports.Priority = _mod_u9vq92.Priority;
8
+ exports.HttpMethodPriority = _mod_u9vq92.HttpMethodPriority;;
@@ -348,7 +348,11 @@ function buildRedirectError(messageOrParams, config, request, response) {
348
348
  return RezoError.createRedirectError("Redirect location not found", errorConfig, errorRequest, errorResponse);
349
349
  }
350
350
  function builErrorFromResponse(message, response, config, request) {
351
- return RezoError.createRedirectError(message, config, request, response);
351
+ const statusCode = response?.status || 0;
352
+ if (statusCode >= 400) {
353
+ return RezoError.createHttpError(statusCode, config, request, response);
354
+ }
355
+ return new RezoError(message, config, "REZ_UNKNOWN_ERROR", request, response);
352
356
  }
353
357
  function buildNetworkError(message, code, config, request) {
354
358
  return RezoError.createNetworkError(message, code, config, request);
@@ -348,7 +348,11 @@ export function buildRedirectError(messageOrParams, config, request, response) {
348
348
  return RezoError.createRedirectError("Redirect location not found", errorConfig, errorRequest, errorResponse);
349
349
  }
350
350
  export function builErrorFromResponse(message, response, config, request) {
351
- return RezoError.createRedirectError(message, config, request, response);
351
+ const statusCode = response?.status || 0;
352
+ if (statusCode >= 400) {
353
+ return RezoError.createHttpError(statusCode, config, request, response);
354
+ }
355
+ return new RezoError(message, config, "REZ_UNKNOWN_ERROR", request, response);
352
356
  }
353
357
  export function buildNetworkError(message, code, config, request) {
354
358
  return RezoError.createNetworkError(message, code, config, request);
@@ -339,6 +339,8 @@ function buildResponse(params) {
339
339
  setCookiesString: []
340
340
  };
341
341
  }
342
+ config.status = statusCode;
343
+ config.statusText = statusMessage;
342
344
  return {
343
345
  data: formatResponse(body, config, rezoHeaders),
344
346
  status: statusCode,
@@ -339,6 +339,8 @@ export function buildResponse(params) {
339
339
  setCookiesString: []
340
340
  };
341
341
  }
342
+ config.status = statusCode;
343
+ config.statusText = statusMessage;
342
344
  return {
343
345
  data: formatResponse(body, config, rezoHeaders),
344
346
  status: statusCode,
@@ -50,16 +50,16 @@ class CompressionUtil {
50
50
  if (!config) {
51
51
  return true;
52
52
  }
53
+ if (config.decompress === false) {
54
+ return false;
55
+ }
53
56
  if (config.compression?.enabled === false) {
54
57
  return false;
55
58
  }
56
- if (config.compression?.enabled === undefined) {
57
- if (config.compression?.algorithms) {
58
- return config.compression.algorithms.includes(contentEncoding.toLowerCase());
59
- }
60
- return true;
59
+ if (config.compression?.algorithms) {
60
+ return config.compression.algorithms.includes(contentEncoding.toLowerCase());
61
61
  }
62
- return config.compression.enabled;
62
+ return true;
63
63
  }
64
64
  static createZstdDecompressStream(response) {
65
65
  const decompressor = getZstdDecompressor();
@@ -50,16 +50,16 @@ export class CompressionUtil {
50
50
  if (!config) {
51
51
  return true;
52
52
  }
53
+ if (config.decompress === false) {
54
+ return false;
55
+ }
53
56
  if (config.compression?.enabled === false) {
54
57
  return false;
55
58
  }
56
- if (config.compression?.enabled === undefined) {
57
- if (config.compression?.algorithms) {
58
- return config.compression.algorithms.includes(contentEncoding.toLowerCase());
59
- }
60
- return true;
59
+ if (config.compression?.algorithms) {
60
+ return config.compression.algorithms.includes(contentEncoding.toLowerCase());
61
61
  }
62
- return config.compression.enabled;
62
+ return true;
63
63
  }
64
64
  static createZstdDecompressStream(response) {
65
65
  const decompressor = getZstdDecompressor();
@@ -156,7 +156,24 @@ class RezoHeaders extends Headers {
156
156
  return "RezoHeaders";
157
157
  }
158
158
  }
159
+ function sanitizeHttp2Headers(headers) {
160
+ const result = {};
161
+ for (const key of Reflect.ownKeys(headers)) {
162
+ if (typeof key === "symbol")
163
+ continue;
164
+ if (key.startsWith(":"))
165
+ continue;
166
+ const value = headers[key];
167
+ if (typeof value === "string") {
168
+ result[key] = value;
169
+ } else if (Array.isArray(value)) {
170
+ result[key] = value.join(", ");
171
+ }
172
+ }
173
+ return result;
174
+ }
159
175
 
160
176
  exports.RezoHeaders = RezoHeaders;
177
+ exports.sanitizeHttp2Headers = sanitizeHttp2Headers;
161
178
  exports.default = RezoHeaders;
162
179
  module.exports = Object.assign(RezoHeaders, exports);
@@ -156,6 +156,22 @@ class RezoHeaders extends Headers {
156
156
  return "RezoHeaders";
157
157
  }
158
158
  }
159
+ function sanitizeHttp2Headers(headers) {
160
+ const result = {};
161
+ for (const key of Reflect.ownKeys(headers)) {
162
+ if (typeof key === "symbol")
163
+ continue;
164
+ if (key.startsWith(":"))
165
+ continue;
166
+ const value = headers[key];
167
+ if (typeof value === "string") {
168
+ result[key] = value;
169
+ } else if (Array.isArray(value)) {
170
+ result[key] = value.join(", ");
171
+ }
172
+ }
173
+ return result;
174
+ }
159
175
 
160
- export { RezoHeaders };
176
+ export { RezoHeaders, sanitizeHttp2Headers };
161
177
  export default RezoHeaders;
@@ -196,7 +196,8 @@ async function getDefaultConfig(config = {}, proxyManager) {
196
196
  hooks: config.hooks,
197
197
  cookieFile: config.cookieFile,
198
198
  encoding: config.encoding,
199
- proxyManager: proxyManager || null
199
+ proxyManager: proxyManager || null,
200
+ decompress: config.decompress
200
201
  };
201
202
  }
202
203
  async function getFS() {
@@ -308,7 +309,23 @@ function prepareHTTPOptions(options, jar, addedOptions, config) {
308
309
  const _body = options.formData || options.multipart;
309
310
  if (_body) {
310
311
  Object.entries(_body).forEach(([key, value]) => {
311
- body.append(key, value);
312
+ if (value === null || value === undefined) {
313
+ body.append(key, "");
314
+ } else if (typeof value === "string" || Buffer.isBuffer(value)) {
315
+ body.append(key, value);
316
+ } else if (typeof value === "object" && typeof value.pipe === "function") {
317
+ body.append(key, value);
318
+ } else if (typeof value === "object" && value.value !== undefined) {
319
+ const val = value.value;
320
+ const opts = value.options || {};
321
+ if (typeof val === "string" || Buffer.isBuffer(val)) {
322
+ body.append(key, val, opts);
323
+ } else {
324
+ body.append(key, String(val), opts);
325
+ }
326
+ } else {
327
+ body.append(key, String(value));
328
+ }
312
329
  });
313
330
  }
314
331
  contentType = body.getContentType();
@@ -344,7 +361,23 @@ function prepareHTTPOptions(options, jar, addedOptions, config) {
344
361
  if (fetchOptions.body && typeof fetchOptions.body === "object") {
345
362
  const formData = new RezoFormData;
346
363
  Object.entries(fetchOptions.body).forEach(([key, value]) => {
347
- formData.append(key, value);
364
+ if (value === null || value === undefined) {
365
+ formData.append(key, "");
366
+ } else if (typeof value === "string" || Buffer.isBuffer(value)) {
367
+ formData.append(key, value);
368
+ } else if (typeof value === "object" && typeof value.pipe === "function") {
369
+ formData.append(key, value);
370
+ } else if (typeof value === "object" && value.value !== undefined) {
371
+ const val = value.value;
372
+ const opts = value.options || {};
373
+ if (typeof val === "string" || Buffer.isBuffer(val)) {
374
+ formData.append(key, val, opts);
375
+ } else {
376
+ formData.append(key, String(val), opts);
377
+ }
378
+ } else {
379
+ formData.append(key, String(value));
380
+ }
348
381
  });
349
382
  fetchOptions.body = formData;
350
383
  }
@@ -544,10 +577,12 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
544
577
  redirectHistory: [],
545
578
  network: {},
546
579
  timing: {},
580
+ transfer: {},
547
581
  responseType: requestOptions.responseType,
548
582
  proxy: normalizedProxy,
549
583
  enableRedirectCycleDetection,
550
- rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true
584
+ rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true,
585
+ decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true
551
586
  };
552
587
  config.setSignal = setSignal.bind(config);
553
588
  if (requestOptions.encoding || defaultOptions.encoding) {
@@ -196,7 +196,8 @@ export async function getDefaultConfig(config = {}, proxyManager) {
196
196
  hooks: config.hooks,
197
197
  cookieFile: config.cookieFile,
198
198
  encoding: config.encoding,
199
- proxyManager: proxyManager || null
199
+ proxyManager: proxyManager || null,
200
+ decompress: config.decompress
200
201
  };
201
202
  }
202
203
  export async function getFS() {
@@ -308,7 +309,23 @@ export function prepareHTTPOptions(options, jar, addedOptions, config) {
308
309
  const _body = options.formData || options.multipart;
309
310
  if (_body) {
310
311
  Object.entries(_body).forEach(([key, value]) => {
311
- body.append(key, value);
312
+ if (value === null || value === undefined) {
313
+ body.append(key, "");
314
+ } else if (typeof value === "string" || Buffer.isBuffer(value)) {
315
+ body.append(key, value);
316
+ } else if (typeof value === "object" && typeof value.pipe === "function") {
317
+ body.append(key, value);
318
+ } else if (typeof value === "object" && value.value !== undefined) {
319
+ const val = value.value;
320
+ const opts = value.options || {};
321
+ if (typeof val === "string" || Buffer.isBuffer(val)) {
322
+ body.append(key, val, opts);
323
+ } else {
324
+ body.append(key, String(val), opts);
325
+ }
326
+ } else {
327
+ body.append(key, String(value));
328
+ }
312
329
  });
313
330
  }
314
331
  contentType = body.getContentType();
@@ -344,7 +361,23 @@ export function prepareHTTPOptions(options, jar, addedOptions, config) {
344
361
  if (fetchOptions.body && typeof fetchOptions.body === "object") {
345
362
  const formData = new RezoFormData;
346
363
  Object.entries(fetchOptions.body).forEach(([key, value]) => {
347
- formData.append(key, value);
364
+ if (value === null || value === undefined) {
365
+ formData.append(key, "");
366
+ } else if (typeof value === "string" || Buffer.isBuffer(value)) {
367
+ formData.append(key, value);
368
+ } else if (typeof value === "object" && typeof value.pipe === "function") {
369
+ formData.append(key, value);
370
+ } else if (typeof value === "object" && value.value !== undefined) {
371
+ const val = value.value;
372
+ const opts = value.options || {};
373
+ if (typeof val === "string" || Buffer.isBuffer(val)) {
374
+ formData.append(key, val, opts);
375
+ } else {
376
+ formData.append(key, String(val), opts);
377
+ }
378
+ } else {
379
+ formData.append(key, String(value));
380
+ }
348
381
  });
349
382
  fetchOptions.body = formData;
350
383
  }
@@ -544,10 +577,12 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
544
577
  redirectHistory: [],
545
578
  network: {},
546
579
  timing: {},
580
+ transfer: {},
547
581
  responseType: requestOptions.responseType,
548
582
  proxy: normalizedProxy,
549
583
  enableRedirectCycleDetection,
550
- rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true
584
+ rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true,
585
+ decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true
551
586
  };
552
587
  config.setSignal = setSignal.bind(config);
553
588
  if (requestOptions.encoding || defaultOptions.encoding) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rezo",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",