rezo 1.0.13 → 1.0.15
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 +16 -12
- package/dist/adapters/curl.js +16 -12
- package/dist/adapters/entries/curl.d.ts +32 -4
- package/dist/adapters/entries/fetch.d.ts +32 -4
- package/dist/adapters/entries/http.d.ts +32 -4
- package/dist/adapters/entries/http2.d.ts +32 -4
- package/dist/adapters/entries/react-native.d.ts +32 -4
- package/dist/adapters/entries/xhr.d.ts +32 -4
- package/dist/adapters/fetch.cjs +24 -1
- package/dist/adapters/fetch.js +24 -1
- package/dist/adapters/http.cjs +23 -0
- package/dist/adapters/http.js +23 -0
- package/dist/adapters/http2.cjs +24 -1
- package/dist/adapters/http2.js +24 -1
- package/dist/adapters/index.cjs +6 -6
- package/dist/adapters/picker.cjs +1 -1
- package/dist/adapters/picker.js +1 -1
- package/dist/cache/index.cjs +13 -13
- package/dist/core/rezo.cjs +29 -8
- package/dist/core/rezo.js +29 -8
- package/dist/crawler.d.ts +32 -4
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +32 -4
- package/dist/platform/browser.d.ts +32 -4
- package/dist/platform/bun.d.ts +32 -4
- package/dist/platform/deno.d.ts +32 -4
- package/dist/platform/node.d.ts +32 -4
- package/dist/platform/react-native.d.ts +32 -4
- package/dist/platform/worker.d.ts +32 -4
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/utils/form-data.cjs +64 -7
- package/dist/utils/form-data.js +64 -7
- package/dist/utils/http-config.cjs +1 -1
- package/dist/utils/http-config.js +1 -1
- package/package.json +1 -1
|
@@ -314,11 +314,19 @@ export declare class RezoFormData extends NodeFormData {
|
|
|
314
314
|
toBuffer(): Buffer;
|
|
315
315
|
/**
|
|
316
316
|
* Create RezoFormData from object
|
|
317
|
+
* Properly handles nested objects by JSON.stringify-ing them
|
|
317
318
|
* @param {Record<string, any>} obj - Object to convert
|
|
318
319
|
* @param {Options} options - Optional RezoFormData options
|
|
319
320
|
* @returns {RezoFormData}
|
|
320
321
|
*/
|
|
321
322
|
static fromObject(obj: Record<string, any>, options?: Options): RezoFormData;
|
|
323
|
+
/**
|
|
324
|
+
* Helper to append a value to FormData with proper type handling
|
|
325
|
+
* @param {RezoFormData} formData - The form data to append to
|
|
326
|
+
* @param {string} key - The field name
|
|
327
|
+
* @param {any} value - The value to append
|
|
328
|
+
*/
|
|
329
|
+
private static appendValue;
|
|
322
330
|
/**
|
|
323
331
|
* Convert to URL query string
|
|
324
332
|
* Warning: File, Blob, and binary data will be omitted
|
|
@@ -2685,8 +2693,19 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2685
2693
|
useProxyManager?: boolean;
|
|
2686
2694
|
/** Whether to enable automatic cookie handling */
|
|
2687
2695
|
useCookies?: boolean;
|
|
2688
|
-
/**
|
|
2689
|
-
|
|
2696
|
+
/**
|
|
2697
|
+
* Custom cookie jar for managing cookies in this request.
|
|
2698
|
+
* Note: Passing jar per-request is supported but not recommended.
|
|
2699
|
+
* For better cookie management, pass the jar when creating the instance:
|
|
2700
|
+
* @example
|
|
2701
|
+
* ```typescript
|
|
2702
|
+
* const client = new Rezo({ jar: myJar });
|
|
2703
|
+
* // or
|
|
2704
|
+
* const client = rezo.create({ jar: myJar });
|
|
2705
|
+
* ```
|
|
2706
|
+
* If you need custom cookies for a single request, use the `cookies` option instead.
|
|
2707
|
+
*/
|
|
2708
|
+
jar?: RezoCookieJar;
|
|
2690
2709
|
/** Cookies to send with the request in various formats */
|
|
2691
2710
|
cookies?: Cookies["array"] | Cookies["netscape"] | Cookies["serialized"] | Cookies["setCookiesString"];
|
|
2692
2711
|
/** Callback for upload progress events */
|
|
@@ -3117,8 +3136,17 @@ export interface RezoDefaultOptions {
|
|
|
3117
3136
|
hooks?: Partial<RezoHooks>;
|
|
3118
3137
|
/** Whether to enable automatic cookie handling (default: true)*/
|
|
3119
3138
|
enableCookieJar?: boolean;
|
|
3120
|
-
/**
|
|
3121
|
-
|
|
3139
|
+
/**
|
|
3140
|
+
* Custom cookie jar for managing cookies.
|
|
3141
|
+
* The recommended way to manage cookies - pass the jar when creating the instance.
|
|
3142
|
+
* @example
|
|
3143
|
+
* ```typescript
|
|
3144
|
+
* const client = new Rezo({ jar: myJar });
|
|
3145
|
+
* // or
|
|
3146
|
+
* const client = rezo.create({ jar: myJar });
|
|
3147
|
+
* ```
|
|
3148
|
+
*/
|
|
3149
|
+
jar?: RezoHttpRequest["jar"];
|
|
3122
3150
|
/** Set default cookies to send with the requests in various formats */
|
|
3123
3151
|
cookies?: RezoHttpRequest["cookies"];
|
|
3124
3152
|
/**
|
|
@@ -314,11 +314,19 @@ export declare class RezoFormData extends NodeFormData {
|
|
|
314
314
|
toBuffer(): Buffer;
|
|
315
315
|
/**
|
|
316
316
|
* Create RezoFormData from object
|
|
317
|
+
* Properly handles nested objects by JSON.stringify-ing them
|
|
317
318
|
* @param {Record<string, any>} obj - Object to convert
|
|
318
319
|
* @param {Options} options - Optional RezoFormData options
|
|
319
320
|
* @returns {RezoFormData}
|
|
320
321
|
*/
|
|
321
322
|
static fromObject(obj: Record<string, any>, options?: Options): RezoFormData;
|
|
323
|
+
/**
|
|
324
|
+
* Helper to append a value to FormData with proper type handling
|
|
325
|
+
* @param {RezoFormData} formData - The form data to append to
|
|
326
|
+
* @param {string} key - The field name
|
|
327
|
+
* @param {any} value - The value to append
|
|
328
|
+
*/
|
|
329
|
+
private static appendValue;
|
|
322
330
|
/**
|
|
323
331
|
* Convert to URL query string
|
|
324
332
|
* Warning: File, Blob, and binary data will be omitted
|
|
@@ -2685,8 +2693,19 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2685
2693
|
useProxyManager?: boolean;
|
|
2686
2694
|
/** Whether to enable automatic cookie handling */
|
|
2687
2695
|
useCookies?: boolean;
|
|
2688
|
-
/**
|
|
2689
|
-
|
|
2696
|
+
/**
|
|
2697
|
+
* Custom cookie jar for managing cookies in this request.
|
|
2698
|
+
* Note: Passing jar per-request is supported but not recommended.
|
|
2699
|
+
* For better cookie management, pass the jar when creating the instance:
|
|
2700
|
+
* @example
|
|
2701
|
+
* ```typescript
|
|
2702
|
+
* const client = new Rezo({ jar: myJar });
|
|
2703
|
+
* // or
|
|
2704
|
+
* const client = rezo.create({ jar: myJar });
|
|
2705
|
+
* ```
|
|
2706
|
+
* If you need custom cookies for a single request, use the `cookies` option instead.
|
|
2707
|
+
*/
|
|
2708
|
+
jar?: RezoCookieJar;
|
|
2690
2709
|
/** Cookies to send with the request in various formats */
|
|
2691
2710
|
cookies?: Cookies["array"] | Cookies["netscape"] | Cookies["serialized"] | Cookies["setCookiesString"];
|
|
2692
2711
|
/** Callback for upload progress events */
|
|
@@ -3117,8 +3136,17 @@ export interface RezoDefaultOptions {
|
|
|
3117
3136
|
hooks?: Partial<RezoHooks>;
|
|
3118
3137
|
/** Whether to enable automatic cookie handling (default: true)*/
|
|
3119
3138
|
enableCookieJar?: boolean;
|
|
3120
|
-
/**
|
|
3121
|
-
|
|
3139
|
+
/**
|
|
3140
|
+
* Custom cookie jar for managing cookies.
|
|
3141
|
+
* The recommended way to manage cookies - pass the jar when creating the instance.
|
|
3142
|
+
* @example
|
|
3143
|
+
* ```typescript
|
|
3144
|
+
* const client = new Rezo({ jar: myJar });
|
|
3145
|
+
* // or
|
|
3146
|
+
* const client = rezo.create({ jar: myJar });
|
|
3147
|
+
* ```
|
|
3148
|
+
*/
|
|
3149
|
+
jar?: RezoHttpRequest["jar"];
|
|
3122
3150
|
/** Set default cookies to send with the requests in various formats */
|
|
3123
3151
|
cookies?: RezoHttpRequest["cookies"];
|
|
3124
3152
|
/**
|
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_xp0ne3 = require('./crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_xp0ne3.Crawler;;
|
|
3
|
+
const _mod_zix686 = require('./crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_zix686.CrawlerOptions;;
|
|
5
|
+
const _mod_lt3nae = require('../cache/file-cacher.cjs');
|
|
6
|
+
exports.FileCacher = _mod_lt3nae.FileCacher;;
|
|
7
|
+
const _mod_6jrabt = require('../cache/url-store.cjs');
|
|
8
|
+
exports.UrlStore = _mod_6jrabt.UrlStore;;
|
|
9
|
+
const _mod_4joht5 = require('./addon/oxylabs/index.cjs');
|
|
10
|
+
exports.Oxylabs = _mod_4joht5.Oxylabs;;
|
|
11
|
+
const _mod_fz188n = require('./addon/oxylabs/options.cjs');
|
|
12
|
+
exports.OXYLABS_BROWSER_TYPES = _mod_fz188n.OXYLABS_BROWSER_TYPES;
|
|
13
|
+
exports.OXYLABS_COMMON_LOCALES = _mod_fz188n.OXYLABS_COMMON_LOCALES;
|
|
14
|
+
exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_fz188n.OXYLABS_COMMON_GEO_LOCATIONS;
|
|
15
|
+
exports.OXYLABS_US_STATES = _mod_fz188n.OXYLABS_US_STATES;
|
|
16
|
+
exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_fz188n.OXYLABS_EUROPEAN_COUNTRIES;
|
|
17
|
+
exports.OXYLABS_ASIAN_COUNTRIES = _mod_fz188n.OXYLABS_ASIAN_COUNTRIES;
|
|
18
|
+
exports.getRandomOxylabsBrowserType = _mod_fz188n.getRandomBrowserType;
|
|
19
|
+
exports.getRandomOxylabsLocale = _mod_fz188n.getRandomLocale;
|
|
20
|
+
exports.getRandomOxylabsGeoLocation = _mod_fz188n.getRandomGeoLocation;;
|
|
21
|
+
const _mod_mycz3h = require('./addon/decodo/index.cjs');
|
|
22
|
+
exports.Decodo = _mod_mycz3h.Decodo;;
|
|
23
|
+
const _mod_omyn21 = require('./addon/decodo/options.cjs');
|
|
24
|
+
exports.DECODO_DEVICE_TYPES = _mod_omyn21.DECODO_DEVICE_TYPES;
|
|
25
|
+
exports.DECODO_HEADLESS_MODES = _mod_omyn21.DECODO_HEADLESS_MODES;
|
|
26
|
+
exports.DECODO_COMMON_LOCALES = _mod_omyn21.DECODO_COMMON_LOCALES;
|
|
27
|
+
exports.DECODO_COMMON_COUNTRIES = _mod_omyn21.DECODO_COMMON_COUNTRIES;
|
|
28
|
+
exports.DECODO_EUROPEAN_COUNTRIES = _mod_omyn21.DECODO_EUROPEAN_COUNTRIES;
|
|
29
|
+
exports.DECODO_ASIAN_COUNTRIES = _mod_omyn21.DECODO_ASIAN_COUNTRIES;
|
|
30
|
+
exports.DECODO_US_STATES = _mod_omyn21.DECODO_US_STATES;
|
|
31
|
+
exports.DECODO_COMMON_CITIES = _mod_omyn21.DECODO_COMMON_CITIES;
|
|
32
|
+
exports.getRandomDecodoDeviceType = _mod_omyn21.getRandomDeviceType;
|
|
33
|
+
exports.getRandomDecodoLocale = _mod_omyn21.getRandomLocale;
|
|
34
|
+
exports.getRandomDecodoCountry = _mod_omyn21.getRandomCountry;
|
|
35
|
+
exports.getRandomDecodoCity = _mod_omyn21.getRandomCity;
|
|
36
|
+
exports.generateDecodoSessionId = _mod_omyn21.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_7lhr2y = require('./manager.cjs');
|
|
5
|
+
exports.ProxyManager = _mod_7lhr2y.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_0fmt7n = require('./queue.cjs');
|
|
2
|
+
exports.RezoQueue = _mod_0fmt7n.RezoQueue;;
|
|
3
|
+
const _mod_lmjsvb = require('./http-queue.cjs');
|
|
4
|
+
exports.HttpQueue = _mod_lmjsvb.HttpQueue;
|
|
5
|
+
exports.extractDomain = _mod_lmjsvb.extractDomain;;
|
|
6
|
+
const _mod_x9aox1 = require('./types.cjs');
|
|
7
|
+
exports.Priority = _mod_x9aox1.Priority;
|
|
8
|
+
exports.HttpMethodPriority = _mod_x9aox1.HttpMethodPriority;;
|
package/dist/utils/form-data.cjs
CHANGED
|
@@ -71,16 +71,73 @@ class RezoFormData extends NodeFormData {
|
|
|
71
71
|
static fromObject(obj, options) {
|
|
72
72
|
const formData = new RezoFormData(options);
|
|
73
73
|
for (const [key, value] of Object.entries(obj)) {
|
|
74
|
-
|
|
75
|
-
for (const item of value) {
|
|
76
|
-
formData.append(key, item);
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
formData.append(key, value);
|
|
80
|
-
}
|
|
74
|
+
RezoFormData.appendValue(formData, key, value);
|
|
81
75
|
}
|
|
82
76
|
return formData;
|
|
83
77
|
}
|
|
78
|
+
static appendValue(formData, key, value) {
|
|
79
|
+
if (value === null || value === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
83
|
+
formData.append(key, String(value));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (Buffer.isBuffer(value)) {
|
|
87
|
+
formData.append(key, value, {
|
|
88
|
+
contentType: "application/octet-stream"
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (value instanceof Uint8Array) {
|
|
93
|
+
formData.append(key, Buffer.from(value), {
|
|
94
|
+
contentType: "application/octet-stream"
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (value instanceof Readable) {
|
|
99
|
+
formData.append(key, value);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (typeof File !== "undefined" && value instanceof File) {
|
|
103
|
+
formData.append(key, value, {
|
|
104
|
+
filename: value.name,
|
|
105
|
+
contentType: value.type || "application/octet-stream"
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (typeof Blob !== "undefined" && value instanceof Blob) {
|
|
110
|
+
formData.append(key, value, {
|
|
111
|
+
contentType: value.type || "application/octet-stream"
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (Array.isArray(value)) {
|
|
116
|
+
for (const item of value) {
|
|
117
|
+
RezoFormData.appendValue(formData, key, item);
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (typeof value === "object" && value !== null && "value" in value && (value.filename || value.contentType)) {
|
|
122
|
+
const opts = {};
|
|
123
|
+
if (value.filename)
|
|
124
|
+
opts.filename = value.filename;
|
|
125
|
+
if (value.contentType)
|
|
126
|
+
opts.contentType = value.contentType;
|
|
127
|
+
formData.append(key, value.value, opts);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (typeof value === "object" && value !== null) {
|
|
131
|
+
const jsonString = JSON.stringify(value);
|
|
132
|
+
const jsonBuffer = Buffer.from(jsonString, "utf8");
|
|
133
|
+
formData.append(key, jsonBuffer, {
|
|
134
|
+
filename: `${key}.json`,
|
|
135
|
+
contentType: "application/json"
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
formData.append(key, String(value));
|
|
140
|
+
}
|
|
84
141
|
async toUrlQueryString(convertBinaryToBase64 = false) {
|
|
85
142
|
const params = new URLSearchParams;
|
|
86
143
|
let hasOmittedData = false;
|
package/dist/utils/form-data.js
CHANGED
|
@@ -71,16 +71,73 @@ export class RezoFormData extends NodeFormData {
|
|
|
71
71
|
static fromObject(obj, options) {
|
|
72
72
|
const formData = new RezoFormData(options);
|
|
73
73
|
for (const [key, value] of Object.entries(obj)) {
|
|
74
|
-
|
|
75
|
-
for (const item of value) {
|
|
76
|
-
formData.append(key, item);
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
formData.append(key, value);
|
|
80
|
-
}
|
|
74
|
+
RezoFormData.appendValue(formData, key, value);
|
|
81
75
|
}
|
|
82
76
|
return formData;
|
|
83
77
|
}
|
|
78
|
+
static appendValue(formData, key, value) {
|
|
79
|
+
if (value === null || value === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
83
|
+
formData.append(key, String(value));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (Buffer.isBuffer(value)) {
|
|
87
|
+
formData.append(key, value, {
|
|
88
|
+
contentType: "application/octet-stream"
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (value instanceof Uint8Array) {
|
|
93
|
+
formData.append(key, Buffer.from(value), {
|
|
94
|
+
contentType: "application/octet-stream"
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (value instanceof Readable) {
|
|
99
|
+
formData.append(key, value);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (typeof File !== "undefined" && value instanceof File) {
|
|
103
|
+
formData.append(key, value, {
|
|
104
|
+
filename: value.name,
|
|
105
|
+
contentType: value.type || "application/octet-stream"
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (typeof Blob !== "undefined" && value instanceof Blob) {
|
|
110
|
+
formData.append(key, value, {
|
|
111
|
+
contentType: value.type || "application/octet-stream"
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (Array.isArray(value)) {
|
|
116
|
+
for (const item of value) {
|
|
117
|
+
RezoFormData.appendValue(formData, key, item);
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (typeof value === "object" && value !== null && "value" in value && (value.filename || value.contentType)) {
|
|
122
|
+
const opts = {};
|
|
123
|
+
if (value.filename)
|
|
124
|
+
opts.filename = value.filename;
|
|
125
|
+
if (value.contentType)
|
|
126
|
+
opts.contentType = value.contentType;
|
|
127
|
+
formData.append(key, value.value, opts);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (typeof value === "object" && value !== null) {
|
|
131
|
+
const jsonString = JSON.stringify(value);
|
|
132
|
+
const jsonBuffer = Buffer.from(jsonString, "utf8");
|
|
133
|
+
formData.append(key, jsonBuffer, {
|
|
134
|
+
filename: `${key}.json`,
|
|
135
|
+
contentType: "application/json"
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
formData.append(key, String(value));
|
|
140
|
+
}
|
|
84
141
|
async toUrlQueryString(convertBinaryToBase64 = false) {
|
|
85
142
|
const params = new URLSearchParams;
|
|
86
143
|
let hasOmittedData = false;
|
|
@@ -562,7 +562,7 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
|
|
|
562
562
|
timeout: typeof requestOptions.timeout === "number" ? requestOptions.timeout : null,
|
|
563
563
|
enableCookieJar: typeof defaultOptions.enableCookieJar === "boolean" ? defaultOptions.enableCookieJar : true,
|
|
564
564
|
useCookies: typeof requestOptions.useCookies === "boolean" ? requestOptions.useCookies : true,
|
|
565
|
-
cookieJar: requestOptions.
|
|
565
|
+
cookieJar: requestOptions.jar || jar,
|
|
566
566
|
retry: {
|
|
567
567
|
maxRetries: retryLimit,
|
|
568
568
|
retryDelay,
|
|
@@ -562,7 +562,7 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
|
|
|
562
562
|
timeout: typeof requestOptions.timeout === "number" ? requestOptions.timeout : null,
|
|
563
563
|
enableCookieJar: typeof defaultOptions.enableCookieJar === "boolean" ? defaultOptions.enableCookieJar : true,
|
|
564
564
|
useCookies: typeof requestOptions.useCookies === "boolean" ? requestOptions.useCookies : true,
|
|
565
|
-
cookieJar: requestOptions.
|
|
565
|
+
cookieJar: requestOptions.jar || jar,
|
|
566
566
|
retry: {
|
|
567
567
|
maxRetries: retryLimit,
|
|
568
568
|
retryDelay,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rezo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
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",
|