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.
- package/dist/adapters/curl.cjs +73 -10
- package/dist/adapters/curl.js +73 -10
- package/dist/adapters/fetch.cjs +106 -59
- package/dist/adapters/fetch.js +106 -59
- package/dist/adapters/http.cjs +20 -13
- package/dist/adapters/http.js +20 -13
- package/dist/adapters/http2.cjs +114 -59
- package/dist/adapters/http2.js +114 -59
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/buildError.cjs +5 -1
- package/dist/responses/buildError.js +5 -1
- package/dist/responses/buildResponse.cjs +2 -0
- package/dist/responses/buildResponse.js +2 -0
- package/dist/utils/compression.cjs +6 -6
- package/dist/utils/compression.js +6 -6
- package/dist/utils/headers.cjs +17 -0
- package/dist/utils/headers.js +17 -1
- package/dist/utils/http-config.cjs +39 -4
- package/dist/utils/http-config.js +39 -4
- package/package.json +1 -1
package/dist/entries/crawler.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
exports.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
|
|
2
|
-
exports.Rezo =
|
|
3
|
-
exports.createRezoInstance =
|
|
4
|
-
exports.createDefaultInstance =
|
|
5
|
-
const
|
|
6
|
-
exports.RezoError =
|
|
7
|
-
exports.RezoErrorCode =
|
|
8
|
-
const
|
|
9
|
-
exports.RezoHeaders =
|
|
10
|
-
const
|
|
11
|
-
exports.RezoFormData =
|
|
12
|
-
const
|
|
13
|
-
exports.RezoCookieJar =
|
|
14
|
-
exports.Cookie =
|
|
15
|
-
const
|
|
16
|
-
exports.createDefaultHooks =
|
|
17
|
-
exports.mergeHooks =
|
|
18
|
-
const
|
|
19
|
-
exports.ProxyManager =
|
|
20
|
-
const
|
|
21
|
-
exports.RezoQueue =
|
|
22
|
-
exports.HttpQueue =
|
|
23
|
-
exports.Priority =
|
|
24
|
-
exports.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;
|
package/dist/plugin/index.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
const
|
|
6
|
-
exports.FileCacher =
|
|
7
|
-
const
|
|
8
|
-
exports.UrlStore =
|
|
9
|
-
const
|
|
10
|
-
exports.Oxylabs =
|
|
11
|
-
const
|
|
12
|
-
exports.OXYLABS_BROWSER_TYPES =
|
|
13
|
-
exports.OXYLABS_COMMON_LOCALES =
|
|
14
|
-
exports.OXYLABS_COMMON_GEO_LOCATIONS =
|
|
15
|
-
exports.OXYLABS_US_STATES =
|
|
16
|
-
exports.OXYLABS_EUROPEAN_COUNTRIES =
|
|
17
|
-
exports.OXYLABS_ASIAN_COUNTRIES =
|
|
18
|
-
exports.getRandomOxylabsBrowserType =
|
|
19
|
-
exports.getRandomOxylabsLocale =
|
|
20
|
-
exports.getRandomOxylabsGeoLocation =
|
|
21
|
-
const
|
|
22
|
-
exports.Decodo =
|
|
23
|
-
const
|
|
24
|
-
exports.DECODO_DEVICE_TYPES =
|
|
25
|
-
exports.DECODO_HEADLESS_MODES =
|
|
26
|
-
exports.DECODO_COMMON_LOCALES =
|
|
27
|
-
exports.DECODO_COMMON_COUNTRIES =
|
|
28
|
-
exports.DECODO_EUROPEAN_COUNTRIES =
|
|
29
|
-
exports.DECODO_ASIAN_COUNTRIES =
|
|
30
|
-
exports.DECODO_US_STATES =
|
|
31
|
-
exports.DECODO_COMMON_CITIES =
|
|
32
|
-
exports.getRandomDecodoDeviceType =
|
|
33
|
-
exports.getRandomDecodoLocale =
|
|
34
|
-
exports.getRandomDecodoCountry =
|
|
35
|
-
exports.getRandomDecodoCity =
|
|
36
|
-
exports.generateDecodoSessionId =
|
|
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;;
|
package/dist/proxy/index.cjs
CHANGED
|
@@ -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
|
|
5
|
-
exports.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 {
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.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
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -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?.
|
|
57
|
-
|
|
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
|
|
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?.
|
|
57
|
-
|
|
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
|
|
62
|
+
return true;
|
|
63
63
|
}
|
|
64
64
|
static createZstdDecompressStream(response) {
|
|
65
65
|
const decompressor = getZstdDecompressor();
|
package/dist/utils/headers.cjs
CHANGED
|
@@ -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);
|
package/dist/utils/headers.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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",
|