@upcoming/bee-js 9.4.0 → 9.4.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/cjs/utils/http.js
CHANGED
|
@@ -8,13 +8,6 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
8
8
|
const cafe_utility_1 = require("cafe-utility");
|
|
9
9
|
const index_1 = require("../index");
|
|
10
10
|
const { AxiosError } = axios_1.default;
|
|
11
|
-
const originalObjectKeys = Object.keys;
|
|
12
|
-
Object.keys = function (o) {
|
|
13
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(o)) {
|
|
14
|
-
return ['axios_workaround_for_buffer'];
|
|
15
|
-
}
|
|
16
|
-
return originalObjectKeys(o);
|
|
17
|
-
};
|
|
18
11
|
const MAX_FAILED_ATTEMPTS = 100000;
|
|
19
12
|
const DELAY_FAST = 200;
|
|
20
13
|
const DELAY_SLOW = 1000;
|
|
@@ -33,6 +26,9 @@ exports.DEFAULT_HTTP_CONFIG = {
|
|
|
33
26
|
*/
|
|
34
27
|
async function http(options, config) {
|
|
35
28
|
const requestConfig = cafe_utility_1.Objects.deepMerge3(exports.DEFAULT_HTTP_CONFIG, config, options);
|
|
29
|
+
if (requestConfig.data && typeof Buffer !== 'undefined' && Buffer.isBuffer(requestConfig.data)) {
|
|
30
|
+
requestConfig.data = requestConfig.data.buffer;
|
|
31
|
+
}
|
|
36
32
|
if (requestConfig.params) {
|
|
37
33
|
const keys = Object.keys(requestConfig.params);
|
|
38
34
|
for (const key of keys) {
|