groove-dev 0.27.143 → 0.27.145
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/CLAUDE.md +0 -7
- package/node_modules/@groove-dev/cli/package.json +1 -1
- package/node_modules/@groove-dev/daemon/package.json +1 -1
- package/node_modules/@groove-dev/daemon/src/api.js +1086 -6532
- package/node_modules/@groove-dev/daemon/src/conversations.js +18 -48
- package/node_modules/@groove-dev/daemon/src/gateways/manager.js +35 -1
- package/node_modules/@groove-dev/daemon/src/index.js +3 -0
- package/node_modules/@groove-dev/daemon/src/journalist.js +23 -13
- package/node_modules/@groove-dev/daemon/src/mlx-server.js +365 -0
- package/node_modules/@groove-dev/daemon/src/model-lab.js +308 -12
- package/node_modules/@groove-dev/daemon/src/pm.js +1 -1
- package/node_modules/@groove-dev/daemon/src/process.js +2 -2
- package/node_modules/@groove-dev/daemon/src/providers/local.js +36 -8
- package/node_modules/@groove-dev/daemon/src/registry.js +21 -5
- package/node_modules/@groove-dev/daemon/src/routes/agents.js +812 -0
- package/node_modules/@groove-dev/daemon/src/routes/coordination.js +318 -0
- package/node_modules/@groove-dev/daemon/src/routes/files.js +751 -0
- package/node_modules/@groove-dev/daemon/src/routes/integrations.js +485 -0
- package/node_modules/@groove-dev/daemon/src/routes/network.js +1784 -0
- package/node_modules/@groove-dev/daemon/src/routes/providers.js +755 -0
- package/node_modules/@groove-dev/daemon/src/routes/schedules.js +110 -0
- package/node_modules/@groove-dev/daemon/src/routes/teams.js +650 -0
- package/node_modules/@groove-dev/daemon/src/scheduler.js +456 -24
- package/node_modules/@groove-dev/daemon/src/teams.js +1 -1
- package/node_modules/@groove-dev/daemon/src/validate.js +38 -1
- package/node_modules/@groove-dev/daemon/templates/mlx-setup.json +12 -0
- package/node_modules/@groove-dev/daemon/templates/tgi-setup.json +1 -1
- package/node_modules/@groove-dev/daemon/templates/vllm-setup.json +1 -1
- package/node_modules/@groove-dev/daemon/test/introducer.test.js +3 -3
- package/node_modules/@groove-dev/daemon/test/journalist.test.js +7 -10
- package/node_modules/@groove-dev/daemon/test/registry.test.js +38 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-Bxc0gU06.js +1006 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-C0pztKBn.css +1 -0
- package/node_modules/@groove-dev/gui/dist/index.html +2 -2
- package/node_modules/@groove-dev/gui/package.json +1 -1
- package/node_modules/@groove-dev/gui/src/{app.jsx → App.jsx} +0 -2
- package/node_modules/@groove-dev/gui/src/app.css +35 -0
- package/node_modules/@groove-dev/gui/src/components/agents/agent-config.jsx +1 -128
- package/node_modules/@groove-dev/gui/src/components/agents/agent-feed.jsx +210 -112
- package/node_modules/@groove-dev/gui/src/components/agents/agent-node.jsx +8 -13
- package/node_modules/@groove-dev/gui/src/components/agents/agent-panel.jsx +2 -70
- package/node_modules/@groove-dev/gui/src/components/agents/code-review.jsx +159 -122
- package/node_modules/@groove-dev/gui/src/components/agents/diff-viewer.jsx +23 -23
- package/node_modules/@groove-dev/gui/src/components/agents/journalist-panel.jsx +1 -1
- package/node_modules/@groove-dev/gui/src/components/agents/spawn-wizard.jsx +2 -135
- package/node_modules/@groove-dev/gui/src/components/automations/automation-card.jsx +274 -0
- package/node_modules/@groove-dev/gui/src/components/automations/automation-wizard.jsx +1136 -0
- package/node_modules/@groove-dev/gui/src/components/chat/chat-header.jsx +2 -0
- package/node_modules/@groove-dev/gui/src/components/chat/chat-input.jsx +68 -66
- package/node_modules/@groove-dev/gui/src/components/chat/chat-view.jsx +4 -8
- package/node_modules/@groove-dev/gui/src/components/dashboard/activity-feed.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/dashboard/cache-ring.jsx +5 -5
- package/node_modules/@groove-dev/gui/src/components/dashboard/context-gauges.jsx +6 -8
- package/node_modules/@groove-dev/gui/src/components/dashboard/fleet-panel.jsx +8 -14
- package/node_modules/@groove-dev/gui/src/components/dashboard/intel-panel.jsx +238 -656
- package/node_modules/@groove-dev/gui/src/components/dashboard/kpi-card.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/dashboard/routing-chart.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/dashboard/team-burn-panel.jsx +1 -1
- package/node_modules/@groove-dev/gui/src/components/dashboard/token-chart.jsx +4 -4
- package/node_modules/@groove-dev/gui/src/components/lab/chat-playground.jsx +39 -31
- package/node_modules/@groove-dev/gui/src/components/lab/lab-assistant.jsx +316 -82
- package/node_modules/@groove-dev/gui/src/components/lab/metrics-panel.jsx +187 -32
- package/node_modules/@groove-dev/gui/src/components/lab/parameter-panel.jsx +200 -18
- package/node_modules/@groove-dev/gui/src/components/lab/preset-manager.jsx +17 -14
- package/node_modules/@groove-dev/gui/src/components/lab/runtime-config.jsx +335 -152
- package/node_modules/@groove-dev/gui/src/components/lab/system-prompt-editor.jsx +10 -8
- package/node_modules/@groove-dev/gui/src/components/layout/activity-bar.jsx +2 -4
- package/node_modules/@groove-dev/gui/src/components/layout/terminal-panel.jsx +4 -2
- package/node_modules/@groove-dev/gui/src/components/layout/welcome-splash.jsx +137 -108
- package/node_modules/@groove-dev/gui/src/components/network/network-health.jsx +2 -2
- package/node_modules/@groove-dev/gui/src/components/network/performance-dashboard.jsx +4 -4
- package/node_modules/@groove-dev/gui/src/components/settings/ssh-wizard.jsx +81 -99
- package/node_modules/@groove-dev/gui/src/components/ui/sheet.jsx +5 -2
- package/node_modules/@groove-dev/gui/src/components/ui/slider.jsx +8 -8
- package/node_modules/@groove-dev/gui/src/lib/cron.js +64 -0
- package/node_modules/@groove-dev/gui/src/lib/status.js +25 -24
- package/node_modules/@groove-dev/gui/src/lib/theme-hex.js +1 -0
- package/node_modules/@groove-dev/gui/src/stores/groove.js +51 -3144
- package/node_modules/@groove-dev/gui/src/stores/helpers.js +10 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/agents-slice.js +459 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/automations-slice.js +96 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/chat-slice.js +226 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/editor-slice.js +285 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/marketplace-slice.js +461 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/network-slice.js +361 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/preview-slice.js +109 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/providers-slice.js +897 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/teams-slice.js +413 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/ui-slice.js +98 -0
- package/node_modules/@groove-dev/gui/src/views/agents.jsx +5 -5
- package/node_modules/@groove-dev/gui/src/views/dashboard.jsx +12 -13
- package/node_modules/@groove-dev/gui/src/views/marketplace.jsx +191 -3
- package/node_modules/@groove-dev/gui/src/views/model-lab.jsx +54 -12
- package/node_modules/@groove-dev/gui/src/views/models.jsx +419 -496
- package/node_modules/@groove-dev/gui/src/views/network.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/views/settings.jsx +81 -94
- package/node_modules/@groove-dev/gui/src/views/teams.jsx +40 -483
- package/node_modules/axios/CHANGELOG.md +260 -0
- package/node_modules/axios/README.md +595 -223
- package/node_modules/axios/dist/axios.js +1460 -1090
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +1560 -1132
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +1557 -1128
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +1594 -1057
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +40 -41
- package/node_modules/axios/index.d.ts +151 -227
- package/node_modules/axios/index.js +2 -0
- package/node_modules/axios/lib/adapters/adapters.js +4 -2
- package/node_modules/axios/lib/adapters/fetch.js +147 -16
- package/node_modules/axios/lib/adapters/http.js +306 -58
- package/node_modules/axios/lib/adapters/xhr.js +6 -2
- package/node_modules/axios/lib/core/Axios.js +7 -3
- package/node_modules/axios/lib/core/AxiosError.js +120 -34
- package/node_modules/axios/lib/core/AxiosHeaders.js +27 -25
- package/node_modules/axios/lib/core/buildFullPath.js +1 -1
- package/node_modules/axios/lib/core/dispatchRequest.js +19 -7
- package/node_modules/axios/lib/core/mergeConfig.js +21 -4
- package/node_modules/axios/lib/core/settle.js +7 -11
- package/node_modules/axios/lib/defaults/index.js +14 -9
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
- package/node_modules/axios/lib/helpers/buildURL.js +1 -1
- package/node_modules/axios/lib/helpers/cookies.js +14 -2
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +28 -1
- package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
- package/node_modules/axios/lib/helpers/formDataToStream.js +3 -2
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
- package/node_modules/axios/lib/helpers/resolveConfig.js +54 -18
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +74 -2
- package/node_modules/axios/lib/helpers/toFormData.js +10 -2
- package/node_modules/axios/lib/helpers/validator.js +3 -1
- package/node_modules/axios/lib/utils.js +33 -21
- package/node_modules/axios/package.json +17 -24
- package/node_modules/follow-redirects/README.md +7 -5
- package/node_modules/follow-redirects/index.js +24 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/daemon/package.json +1 -1
- package/packages/daemon/src/api.js +1086 -6532
- package/packages/daemon/src/conversations.js +18 -48
- package/packages/daemon/src/gateways/manager.js +35 -1
- package/packages/daemon/src/index.js +3 -0
- package/packages/daemon/src/journalist.js +23 -13
- package/packages/daemon/src/mlx-server.js +365 -0
- package/packages/daemon/src/model-lab.js +308 -12
- package/packages/daemon/src/pm.js +1 -1
- package/packages/daemon/src/process.js +2 -2
- package/packages/daemon/src/providers/local.js +36 -8
- package/packages/daemon/src/registry.js +21 -5
- package/packages/daemon/src/routes/agents.js +812 -0
- package/packages/daemon/src/routes/coordination.js +318 -0
- package/packages/daemon/src/routes/files.js +751 -0
- package/packages/daemon/src/routes/integrations.js +485 -0
- package/packages/daemon/src/routes/network.js +1784 -0
- package/packages/daemon/src/routes/providers.js +755 -0
- package/packages/daemon/src/routes/schedules.js +110 -0
- package/packages/daemon/src/routes/teams.js +650 -0
- package/packages/daemon/src/scheduler.js +456 -24
- package/packages/daemon/src/teams.js +1 -1
- package/packages/daemon/src/validate.js +38 -1
- package/packages/daemon/templates/mlx-setup.json +12 -0
- package/packages/daemon/templates/tgi-setup.json +1 -1
- package/packages/daemon/templates/vllm-setup.json +1 -1
- package/packages/gui/dist/assets/index-Bxc0gU06.js +1006 -0
- package/packages/gui/dist/assets/index-C0pztKBn.css +1 -0
- package/packages/gui/dist/index.html +2 -2
- package/packages/gui/package.json +1 -1
- package/packages/gui/src/{app.jsx → App.jsx} +0 -2
- package/packages/gui/src/app.css +35 -0
- package/packages/gui/src/components/agents/agent-config.jsx +1 -128
- package/packages/gui/src/components/agents/agent-feed.jsx +210 -112
- package/packages/gui/src/components/agents/agent-node.jsx +8 -13
- package/packages/gui/src/components/agents/agent-panel.jsx +2 -70
- package/packages/gui/src/components/agents/code-review.jsx +159 -122
- package/packages/gui/src/components/agents/diff-viewer.jsx +23 -23
- package/packages/gui/src/components/agents/journalist-panel.jsx +1 -1
- package/packages/gui/src/components/agents/spawn-wizard.jsx +2 -135
- package/packages/gui/src/components/automations/automation-card.jsx +274 -0
- package/packages/gui/src/components/automations/automation-wizard.jsx +1136 -0
- package/packages/gui/src/components/chat/chat-header.jsx +2 -0
- package/packages/gui/src/components/chat/chat-input.jsx +68 -66
- package/packages/gui/src/components/chat/chat-view.jsx +4 -8
- package/packages/gui/src/components/dashboard/activity-feed.jsx +3 -3
- package/packages/gui/src/components/dashboard/cache-ring.jsx +5 -5
- package/packages/gui/src/components/dashboard/context-gauges.jsx +6 -8
- package/packages/gui/src/components/dashboard/fleet-panel.jsx +8 -14
- package/packages/gui/src/components/dashboard/intel-panel.jsx +238 -656
- package/packages/gui/src/components/dashboard/kpi-card.jsx +3 -3
- package/packages/gui/src/components/dashboard/routing-chart.jsx +3 -3
- package/packages/gui/src/components/dashboard/team-burn-panel.jsx +1 -1
- package/packages/gui/src/components/dashboard/token-chart.jsx +4 -4
- package/packages/gui/src/components/lab/chat-playground.jsx +39 -31
- package/packages/gui/src/components/lab/lab-assistant.jsx +316 -82
- package/packages/gui/src/components/lab/metrics-panel.jsx +187 -32
- package/packages/gui/src/components/lab/parameter-panel.jsx +200 -18
- package/packages/gui/src/components/lab/preset-manager.jsx +17 -14
- package/packages/gui/src/components/lab/runtime-config.jsx +335 -152
- package/packages/gui/src/components/lab/system-prompt-editor.jsx +10 -8
- package/packages/gui/src/components/layout/activity-bar.jsx +2 -4
- package/packages/gui/src/components/layout/terminal-panel.jsx +4 -2
- package/packages/gui/src/components/layout/welcome-splash.jsx +137 -108
- package/packages/gui/src/components/network/network-health.jsx +2 -2
- package/packages/gui/src/components/network/performance-dashboard.jsx +4 -4
- package/packages/gui/src/components/settings/ssh-wizard.jsx +81 -99
- package/packages/gui/src/components/ui/sheet.jsx +5 -2
- package/packages/gui/src/components/ui/slider.jsx +8 -8
- package/packages/gui/src/lib/cron.js +64 -0
- package/packages/gui/src/lib/status.js +25 -24
- package/packages/gui/src/lib/theme-hex.js +1 -0
- package/packages/gui/src/stores/groove.js +51 -3144
- package/packages/gui/src/stores/helpers.js +10 -0
- package/packages/gui/src/stores/slices/agents-slice.js +459 -0
- package/packages/gui/src/stores/slices/automations-slice.js +96 -0
- package/packages/gui/src/stores/slices/chat-slice.js +226 -0
- package/packages/gui/src/stores/slices/editor-slice.js +285 -0
- package/packages/gui/src/stores/slices/marketplace-slice.js +461 -0
- package/packages/gui/src/stores/slices/network-slice.js +361 -0
- package/packages/gui/src/stores/slices/preview-slice.js +109 -0
- package/packages/gui/src/stores/slices/providers-slice.js +897 -0
- package/packages/gui/src/stores/slices/teams-slice.js +413 -0
- package/packages/gui/src/stores/slices/ui-slice.js +98 -0
- package/packages/gui/src/views/agents.jsx +5 -5
- package/packages/gui/src/views/dashboard.jsx +12 -13
- package/packages/gui/src/views/marketplace.jsx +191 -3
- package/packages/gui/src/views/model-lab.jsx +54 -12
- package/packages/gui/src/views/models.jsx +419 -496
- package/packages/gui/src/views/network.jsx +3 -3
- package/packages/gui/src/views/settings.jsx +81 -94
- package/packages/gui/src/views/teams.jsx +40 -483
- package/SECURITY_SWEEP.md +0 -228
- package/TRAINING_DATA_v4.md +0 -6
- package/node_modules/@groove-dev/gui/dist/assets/index-CCVvAoQn.css +0 -1
- package/node_modules/@groove-dev/gui/dist/assets/index-DGIv_TRm.js +0 -984
- package/node_modules/@groove-dev/gui/src/components/agents/agent-chat.jsx +0 -379
- package/node_modules/@groove-dev/gui/src/views/preview.jsx +0 -6
- package/node_modules/@groove-dev/gui/src/views/subscription-panel.jsx +0 -327
- package/packages/gui/dist/assets/index-CCVvAoQn.css +0 -1
- package/packages/gui/dist/assets/index-DGIv_TRm.js +0 -984
- package/packages/gui/src/components/agents/agent-chat.jsx +0 -379
- package/packages/gui/src/views/preview.jsx +0 -6
- package/packages/gui/src/views/subscription-panel.jsx +0 -327
- package/test.py +0 -571
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
2
2
|
/**
|
|
3
3
|
* Create a bound version of a function with a specified `this` context
|
|
4
4
|
*
|
|
@@ -202,9 +202,9 @@ const isFile = kindOfTest('File');
|
|
|
202
202
|
* also have a `name` and `type` attribute to specify filename and content type
|
|
203
203
|
*
|
|
204
204
|
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
205
|
-
*
|
|
205
|
+
*
|
|
206
206
|
* @param {*} value The value to test
|
|
207
|
-
*
|
|
207
|
+
*
|
|
208
208
|
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
209
209
|
*/
|
|
210
210
|
const isReactNativeBlob = (value) => {
|
|
@@ -214,9 +214,9 @@ const isReactNativeBlob = (value) => {
|
|
|
214
214
|
/**
|
|
215
215
|
* Determine if environment is React Native
|
|
216
216
|
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
217
|
-
*
|
|
217
|
+
*
|
|
218
218
|
* @param {*} formData The formData to test
|
|
219
|
-
*
|
|
219
|
+
*
|
|
220
220
|
* @returns {boolean} True if environment is React Native, otherwise false
|
|
221
221
|
*/
|
|
222
222
|
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
@@ -235,7 +235,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
235
235
|
*
|
|
236
236
|
* @param {*} val The value to test
|
|
237
237
|
*
|
|
238
|
-
* @returns {boolean} True if value is a
|
|
238
|
+
* @returns {boolean} True if value is a FileList, otherwise false
|
|
239
239
|
*/
|
|
240
240
|
const isFileList = kindOfTest('FileList');
|
|
241
241
|
|
|
@@ -267,15 +267,17 @@ const G = getGlobal();
|
|
|
267
267
|
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
268
268
|
|
|
269
269
|
const isFormData = (thing) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
270
|
+
if (!thing) return false;
|
|
271
|
+
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
272
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
|
|
273
|
+
const proto = getPrototypeOf(thing);
|
|
274
|
+
if (!proto || proto === Object.prototype) return false;
|
|
275
|
+
if (!isFunction$1(thing.append)) return false;
|
|
276
|
+
const kind = kindOf(thing);
|
|
277
|
+
return (
|
|
278
|
+
kind === 'formdata' ||
|
|
279
|
+
// detect form-data instance
|
|
280
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
279
281
|
);
|
|
280
282
|
};
|
|
281
283
|
|
|
@@ -411,7 +413,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
411
413
|
*
|
|
412
414
|
* @returns {Object} Result of all merge properties
|
|
413
415
|
*/
|
|
414
|
-
function merge(
|
|
416
|
+
function merge(...objs) {
|
|
415
417
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
416
418
|
const result = {};
|
|
417
419
|
const assignValue = (val, key) => {
|
|
@@ -421,8 +423,12 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
421
423
|
}
|
|
422
424
|
|
|
423
425
|
const targetKey = (caseless && findKey(result, key)) || key;
|
|
424
|
-
|
|
425
|
-
|
|
426
|
+
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
427
|
+
// chain, so a polluted Object.prototype value could surface here and get
|
|
428
|
+
// copied into the merged result.
|
|
429
|
+
const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
|
|
430
|
+
if (isPlainObject(existing) && isPlainObject(val)) {
|
|
431
|
+
result[targetKey] = merge(existing, val);
|
|
426
432
|
} else if (isPlainObject(val)) {
|
|
427
433
|
result[targetKey] = merge({}, val);
|
|
428
434
|
} else if (isArray(val)) {
|
|
@@ -432,8 +438,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
432
438
|
}
|
|
433
439
|
};
|
|
434
440
|
|
|
435
|
-
for (let i = 0, l =
|
|
436
|
-
|
|
441
|
+
for (let i = 0, l = objs.length; i < l; i++) {
|
|
442
|
+
objs[i] && forEach(objs[i], assignValue);
|
|
437
443
|
}
|
|
438
444
|
return result;
|
|
439
445
|
}
|
|
@@ -455,6 +461,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
455
461
|
(val, key) => {
|
|
456
462
|
if (thisArg && isFunction$1(val)) {
|
|
457
463
|
Object.defineProperty(a, key, {
|
|
464
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
465
|
+
// hijack defineProperty's accessor-vs-data resolution.
|
|
466
|
+
__proto__: null,
|
|
458
467
|
value: bind(val, thisArg),
|
|
459
468
|
writable: true,
|
|
460
469
|
enumerable: true,
|
|
@@ -462,6 +471,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
462
471
|
});
|
|
463
472
|
} else {
|
|
464
473
|
Object.defineProperty(a, key, {
|
|
474
|
+
__proto__: null,
|
|
465
475
|
value: val,
|
|
466
476
|
writable: true,
|
|
467
477
|
enumerable: true,
|
|
@@ -500,12 +510,14 @@ const stripBOM = (content) => {
|
|
|
500
510
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
501
511
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
502
512
|
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
513
|
+
__proto__: null,
|
|
503
514
|
value: constructor,
|
|
504
515
|
writable: true,
|
|
505
516
|
enumerable: false,
|
|
506
517
|
configurable: true,
|
|
507
518
|
});
|
|
508
519
|
Object.defineProperty(constructor, 'super', {
|
|
520
|
+
__proto__: null,
|
|
509
521
|
value: superConstructor.prototype,
|
|
510
522
|
});
|
|
511
523
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -687,7 +699,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
687
699
|
const freezeMethods = (obj) => {
|
|
688
700
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
689
701
|
// skip restricted props in strict mode
|
|
690
|
-
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].
|
|
702
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
|
|
691
703
|
return false;
|
|
692
704
|
}
|
|
693
705
|
|
|
@@ -928,1298 +940,1399 @@ var utils$1 = {
|
|
|
928
940
|
isIterable,
|
|
929
941
|
};
|
|
930
942
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
943
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
944
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
945
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
946
|
+
'age',
|
|
947
|
+
'authorization',
|
|
948
|
+
'content-length',
|
|
949
|
+
'content-type',
|
|
950
|
+
'etag',
|
|
951
|
+
'expires',
|
|
952
|
+
'from',
|
|
953
|
+
'host',
|
|
954
|
+
'if-modified-since',
|
|
955
|
+
'if-unmodified-since',
|
|
956
|
+
'last-modified',
|
|
957
|
+
'location',
|
|
958
|
+
'max-forwards',
|
|
959
|
+
'proxy-authorization',
|
|
960
|
+
'referer',
|
|
961
|
+
'retry-after',
|
|
962
|
+
'user-agent',
|
|
963
|
+
]);
|
|
936
964
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
965
|
+
/**
|
|
966
|
+
* Parse headers into an object
|
|
967
|
+
*
|
|
968
|
+
* ```
|
|
969
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
970
|
+
* Content-Type: application/json
|
|
971
|
+
* Connection: keep-alive
|
|
972
|
+
* Transfer-Encoding: chunked
|
|
973
|
+
* ```
|
|
974
|
+
*
|
|
975
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
976
|
+
*
|
|
977
|
+
* @returns {Object} Headers parsed into an object
|
|
978
|
+
*/
|
|
979
|
+
var parseHeaders = (rawHeaders) => {
|
|
980
|
+
const parsed = {};
|
|
981
|
+
let key;
|
|
982
|
+
let val;
|
|
983
|
+
let i;
|
|
941
984
|
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
985
|
+
rawHeaders &&
|
|
986
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
987
|
+
i = line.indexOf(':');
|
|
988
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
989
|
+
val = line.substring(i + 1).trim();
|
|
945
990
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
super(message);
|
|
959
|
-
|
|
960
|
-
// Make message enumerable to maintain backward compatibility
|
|
961
|
-
// The native Error constructor sets message as non-enumerable,
|
|
962
|
-
// but axios < v1.13.3 had it as enumerable
|
|
963
|
-
Object.defineProperty(this, 'message', {
|
|
964
|
-
value: message,
|
|
965
|
-
enumerable: true,
|
|
966
|
-
writable: true,
|
|
967
|
-
configurable: true
|
|
968
|
-
});
|
|
969
|
-
|
|
970
|
-
this.name = 'AxiosError';
|
|
971
|
-
this.isAxiosError = true;
|
|
972
|
-
code && (this.code = code);
|
|
973
|
-
config && (this.config = config);
|
|
974
|
-
request && (this.request = request);
|
|
975
|
-
if (response) {
|
|
976
|
-
this.response = response;
|
|
977
|
-
this.status = response.status;
|
|
991
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
if (key === 'set-cookie') {
|
|
996
|
+
if (parsed[key]) {
|
|
997
|
+
parsed[key].push(val);
|
|
998
|
+
} else {
|
|
999
|
+
parsed[key] = [val];
|
|
1000
|
+
}
|
|
1001
|
+
} else {
|
|
1002
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
978
1003
|
}
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
return parsed;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
const $internals = Symbol('internals');
|
|
1010
|
+
|
|
1011
|
+
const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
1012
|
+
|
|
1013
|
+
function trimSPorHTAB(str) {
|
|
1014
|
+
let start = 0;
|
|
1015
|
+
let end = str.length;
|
|
1016
|
+
|
|
1017
|
+
while (start < end) {
|
|
1018
|
+
const code = str.charCodeAt(start);
|
|
1019
|
+
|
|
1020
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1021
|
+
break;
|
|
979
1022
|
}
|
|
980
1023
|
|
|
981
|
-
|
|
982
|
-
return {
|
|
983
|
-
// Standard
|
|
984
|
-
message: this.message,
|
|
985
|
-
name: this.name,
|
|
986
|
-
// Microsoft
|
|
987
|
-
description: this.description,
|
|
988
|
-
number: this.number,
|
|
989
|
-
// Mozilla
|
|
990
|
-
fileName: this.fileName,
|
|
991
|
-
lineNumber: this.lineNumber,
|
|
992
|
-
columnNumber: this.columnNumber,
|
|
993
|
-
stack: this.stack,
|
|
994
|
-
// Axios
|
|
995
|
-
config: utils$1.toJSONObject(this.config),
|
|
996
|
-
code: this.code,
|
|
997
|
-
status: this.status,
|
|
998
|
-
};
|
|
1024
|
+
start += 1;
|
|
999
1025
|
}
|
|
1000
|
-
};
|
|
1001
1026
|
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1005
|
-
AxiosError$1.ECONNABORTED = 'ECONNABORTED';
|
|
1006
|
-
AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
|
|
1007
|
-
AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
|
|
1008
|
-
AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1009
|
-
AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1010
|
-
AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1011
|
-
AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1012
|
-
AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
|
|
1013
|
-
AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1014
|
-
AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1027
|
+
while (end > start) {
|
|
1028
|
+
const code = str.charCodeAt(end - 1);
|
|
1015
1029
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1030
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1018
1033
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
*
|
|
1022
|
-
* @param {string} thing - The object or array to be visited.
|
|
1023
|
-
*
|
|
1024
|
-
* @returns {boolean}
|
|
1025
|
-
*/
|
|
1026
|
-
function isVisitable(thing) {
|
|
1027
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
1028
|
-
}
|
|
1034
|
+
end -= 1;
|
|
1035
|
+
}
|
|
1029
1036
|
|
|
1030
|
-
|
|
1031
|
-
* It removes the brackets from the end of a string
|
|
1032
|
-
*
|
|
1033
|
-
* @param {string} key - The key of the parameter.
|
|
1034
|
-
*
|
|
1035
|
-
* @returns {string} the key without the brackets.
|
|
1036
|
-
*/
|
|
1037
|
-
function removeBrackets(key) {
|
|
1038
|
-
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
1037
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
1039
1038
|
}
|
|
1040
1039
|
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
*
|
|
1044
|
-
* @param {string} path - The path to the current key.
|
|
1045
|
-
* @param {string} key - The key of the current object being iterated over.
|
|
1046
|
-
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
1047
|
-
*
|
|
1048
|
-
* @returns {string} The path to the current key.
|
|
1049
|
-
*/
|
|
1050
|
-
function renderKey(path, key, dots) {
|
|
1051
|
-
if (!path) return key;
|
|
1052
|
-
return path
|
|
1053
|
-
.concat(key)
|
|
1054
|
-
.map(function each(token, i) {
|
|
1055
|
-
// eslint-disable-next-line no-param-reassign
|
|
1056
|
-
token = removeBrackets(token);
|
|
1057
|
-
return !dots && i ? '[' + token + ']' : token;
|
|
1058
|
-
})
|
|
1059
|
-
.join(dots ? '.' : '');
|
|
1040
|
+
function normalizeHeader(header) {
|
|
1041
|
+
return header && String(header).trim().toLowerCase();
|
|
1060
1042
|
}
|
|
1061
1043
|
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
*
|
|
1065
|
-
* @param {Array<any>} arr - The array to check
|
|
1066
|
-
*
|
|
1067
|
-
* @returns {boolean}
|
|
1068
|
-
*/
|
|
1069
|
-
function isFlatArray(arr) {
|
|
1070
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
1044
|
+
function sanitizeHeaderValue(str) {
|
|
1045
|
+
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
1071
1046
|
}
|
|
1072
1047
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1048
|
+
function normalizeValue(value) {
|
|
1049
|
+
if (value === false || value == null) {
|
|
1050
|
+
return value;
|
|
1051
|
+
}
|
|
1076
1052
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
*
|
|
1080
|
-
* @param {Object} obj
|
|
1081
|
-
* @param {?Object} [formData]
|
|
1082
|
-
* @param {?Object} [options]
|
|
1083
|
-
* @param {Function} [options.visitor]
|
|
1084
|
-
* @param {Boolean} [options.metaTokens = true]
|
|
1085
|
-
* @param {Boolean} [options.dots = false]
|
|
1086
|
-
* @param {?Boolean} [options.indexes = false]
|
|
1087
|
-
*
|
|
1088
|
-
* @returns {Object}
|
|
1089
|
-
**/
|
|
1053
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
1054
|
+
}
|
|
1090
1055
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
*
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
* @returns
|
|
1099
|
-
*/
|
|
1100
|
-
function toFormData$1(obj, formData, options) {
|
|
1101
|
-
if (!utils$1.isObject(obj)) {
|
|
1102
|
-
throw new TypeError('target must be an object');
|
|
1056
|
+
function parseTokens(str) {
|
|
1057
|
+
const tokens = Object.create(null);
|
|
1058
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1059
|
+
let match;
|
|
1060
|
+
|
|
1061
|
+
while ((match = tokensRE.exec(str))) {
|
|
1062
|
+
tokens[match[1]] = match[2];
|
|
1103
1063
|
}
|
|
1104
1064
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1065
|
+
return tokens;
|
|
1066
|
+
}
|
|
1107
1067
|
|
|
1108
|
-
|
|
1109
|
-
options = utils$1.toFlatObject(
|
|
1110
|
-
options,
|
|
1111
|
-
{
|
|
1112
|
-
metaTokens: true,
|
|
1113
|
-
dots: false,
|
|
1114
|
-
indexes: false,
|
|
1115
|
-
},
|
|
1116
|
-
false,
|
|
1117
|
-
function defined(option, source) {
|
|
1118
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1119
|
-
return !utils$1.isUndefined(source[option]);
|
|
1120
|
-
}
|
|
1121
|
-
);
|
|
1068
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1122
1069
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
const indexes = options.indexes;
|
|
1128
|
-
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1129
|
-
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1070
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1071
|
+
if (utils$1.isFunction(filter)) {
|
|
1072
|
+
return filter.call(this, value, header);
|
|
1073
|
+
}
|
|
1130
1074
|
|
|
1131
|
-
if (
|
|
1132
|
-
|
|
1075
|
+
if (isHeaderNameFilter) {
|
|
1076
|
+
value = header;
|
|
1133
1077
|
}
|
|
1134
1078
|
|
|
1135
|
-
|
|
1136
|
-
if (value === null) return '';
|
|
1079
|
+
if (!utils$1.isString(value)) return;
|
|
1137
1080
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1081
|
+
if (utils$1.isString(filter)) {
|
|
1082
|
+
return value.indexOf(filter) !== -1;
|
|
1083
|
+
}
|
|
1141
1084
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1085
|
+
if (utils$1.isRegExp(filter)) {
|
|
1086
|
+
return filter.test(value);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1145
1089
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1090
|
+
function formatHeader(header) {
|
|
1091
|
+
return header
|
|
1092
|
+
.trim()
|
|
1093
|
+
.toLowerCase()
|
|
1094
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1095
|
+
return char.toUpperCase() + str;
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1149
1098
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
}
|
|
1099
|
+
function buildAccessors(obj, header) {
|
|
1100
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1153
1101
|
|
|
1154
|
-
|
|
1102
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
1103
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
1104
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1105
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
1106
|
+
__proto__: null,
|
|
1107
|
+
value: function (arg1, arg2, arg3) {
|
|
1108
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1109
|
+
},
|
|
1110
|
+
configurable: true,
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
1116
|
+
constructor(headers) {
|
|
1117
|
+
headers && this.set(headers);
|
|
1155
1118
|
}
|
|
1156
1119
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
*
|
|
1160
|
-
* @param {*} value
|
|
1161
|
-
* @param {String|Number} key
|
|
1162
|
-
* @param {Array<String|Number>} path
|
|
1163
|
-
* @this {FormData}
|
|
1164
|
-
*
|
|
1165
|
-
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1166
|
-
*/
|
|
1167
|
-
function defaultVisitor(value, key, path) {
|
|
1168
|
-
let arr = value;
|
|
1120
|
+
set(header, valueOrRewrite, rewrite) {
|
|
1121
|
+
const self = this;
|
|
1169
1122
|
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
return false;
|
|
1173
|
-
}
|
|
1123
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1124
|
+
const lHeader = normalizeHeader(_header);
|
|
1174
1125
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
key = metaTokens ? key : key.slice(0, -2);
|
|
1179
|
-
// eslint-disable-next-line no-param-reassign
|
|
1180
|
-
value = JSON.stringify(value);
|
|
1181
|
-
} else if (
|
|
1182
|
-
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1183
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1184
|
-
) {
|
|
1185
|
-
// eslint-disable-next-line no-param-reassign
|
|
1186
|
-
key = removeBrackets(key);
|
|
1126
|
+
if (!lHeader) {
|
|
1127
|
+
throw new Error('header name must be a non-empty string');
|
|
1128
|
+
}
|
|
1187
1129
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
convertValue(el)
|
|
1198
|
-
);
|
|
1199
|
-
});
|
|
1200
|
-
return false;
|
|
1130
|
+
const key = utils$1.findKey(self, lHeader);
|
|
1131
|
+
|
|
1132
|
+
if (
|
|
1133
|
+
!key ||
|
|
1134
|
+
self[key] === undefined ||
|
|
1135
|
+
_rewrite === true ||
|
|
1136
|
+
(_rewrite === undefined && self[key] !== false)
|
|
1137
|
+
) {
|
|
1138
|
+
self[key || _header] = normalizeValue(_value);
|
|
1201
1139
|
}
|
|
1202
1140
|
}
|
|
1203
1141
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
}
|
|
1142
|
+
const setHeaders = (headers, _rewrite) =>
|
|
1143
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1207
1144
|
|
|
1208
|
-
|
|
1145
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1146
|
+
setHeaders(header, valueOrRewrite);
|
|
1147
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1148
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1149
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1150
|
+
let obj = {},
|
|
1151
|
+
dest,
|
|
1152
|
+
key;
|
|
1153
|
+
for (const entry of header) {
|
|
1154
|
+
if (!utils$1.isArray(entry)) {
|
|
1155
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
1156
|
+
}
|
|
1209
1157
|
|
|
1210
|
-
|
|
1158
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
1159
|
+
? utils$1.isArray(dest)
|
|
1160
|
+
? [...dest, entry[1]]
|
|
1161
|
+
: [dest, entry[1]]
|
|
1162
|
+
: entry[1];
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
setHeaders(obj, valueOrRewrite);
|
|
1166
|
+
} else {
|
|
1167
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
return this;
|
|
1211
1171
|
}
|
|
1212
1172
|
|
|
1213
|
-
|
|
1173
|
+
get(header, parser) {
|
|
1174
|
+
header = normalizeHeader(header);
|
|
1214
1175
|
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
convertValue,
|
|
1218
|
-
isVisitable,
|
|
1219
|
-
});
|
|
1176
|
+
if (header) {
|
|
1177
|
+
const key = utils$1.findKey(this, header);
|
|
1220
1178
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1179
|
+
if (key) {
|
|
1180
|
+
const value = this[key];
|
|
1223
1181
|
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1182
|
+
if (!parser) {
|
|
1183
|
+
return value;
|
|
1184
|
+
}
|
|
1227
1185
|
|
|
1228
|
-
|
|
1186
|
+
if (parser === true) {
|
|
1187
|
+
return parseTokens(value);
|
|
1188
|
+
}
|
|
1229
1189
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1190
|
+
if (utils$1.isFunction(parser)) {
|
|
1191
|
+
return parser.call(this, value, key);
|
|
1192
|
+
}
|
|
1234
1193
|
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
});
|
|
1194
|
+
if (utils$1.isRegExp(parser)) {
|
|
1195
|
+
return parser.exec(value);
|
|
1196
|
+
}
|
|
1239
1197
|
|
|
1240
|
-
|
|
1198
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1241
1201
|
}
|
|
1242
1202
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1203
|
+
has(header, matcher) {
|
|
1204
|
+
header = normalizeHeader(header);
|
|
1246
1205
|
|
|
1247
|
-
|
|
1206
|
+
if (header) {
|
|
1207
|
+
const key = utils$1.findKey(this, header);
|
|
1248
1208
|
|
|
1249
|
-
|
|
1250
|
-
|
|
1209
|
+
return !!(
|
|
1210
|
+
key &&
|
|
1211
|
+
this[key] !== undefined &&
|
|
1212
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1251
1215
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
* their percent-encoded equivalents
|
|
1255
|
-
*
|
|
1256
|
-
* @param {string} str - The string to encode.
|
|
1257
|
-
*
|
|
1258
|
-
* @returns {string} The encoded string.
|
|
1259
|
-
*/
|
|
1260
|
-
function encode$1(str) {
|
|
1261
|
-
const charMap = {
|
|
1262
|
-
'!': '%21',
|
|
1263
|
-
"'": '%27',
|
|
1264
|
-
'(': '%28',
|
|
1265
|
-
')': '%29',
|
|
1266
|
-
'~': '%7E',
|
|
1267
|
-
'%20': '+',
|
|
1268
|
-
'%00': '\x00',
|
|
1269
|
-
};
|
|
1270
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1271
|
-
return charMap[match];
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1216
|
+
return false;
|
|
1217
|
+
}
|
|
1274
1218
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1279
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1280
|
-
*
|
|
1281
|
-
* @returns {void}
|
|
1282
|
-
*/
|
|
1283
|
-
function AxiosURLSearchParams(params, options) {
|
|
1284
|
-
this._pairs = [];
|
|
1219
|
+
delete(header, matcher) {
|
|
1220
|
+
const self = this;
|
|
1221
|
+
let deleted = false;
|
|
1285
1222
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1223
|
+
function deleteHeader(_header) {
|
|
1224
|
+
_header = normalizeHeader(_header);
|
|
1288
1225
|
|
|
1289
|
-
|
|
1226
|
+
if (_header) {
|
|
1227
|
+
const key = utils$1.findKey(self, _header);
|
|
1290
1228
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
};
|
|
1229
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1230
|
+
delete self[key];
|
|
1294
1231
|
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
? function (value) {
|
|
1298
|
-
return encoder.call(this, value, encode$1);
|
|
1232
|
+
deleted = true;
|
|
1233
|
+
}
|
|
1299
1234
|
}
|
|
1300
|
-
|
|
1235
|
+
}
|
|
1301
1236
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
};
|
|
1237
|
+
if (utils$1.isArray(header)) {
|
|
1238
|
+
header.forEach(deleteHeader);
|
|
1239
|
+
} else {
|
|
1240
|
+
deleteHeader(header);
|
|
1241
|
+
}
|
|
1308
1242
|
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1312
|
-
*
|
|
1313
|
-
* @param {string} val The value to be encoded.
|
|
1314
|
-
*
|
|
1315
|
-
* @returns {string} The encoded value.
|
|
1316
|
-
*/
|
|
1317
|
-
function encode(val) {
|
|
1318
|
-
return encodeURIComponent(val)
|
|
1319
|
-
.replace(/%3A/gi, ':')
|
|
1320
|
-
.replace(/%24/g, '$')
|
|
1321
|
-
.replace(/%2C/gi, ',')
|
|
1322
|
-
.replace(/%20/g, '+');
|
|
1323
|
-
}
|
|
1243
|
+
return deleted;
|
|
1244
|
+
}
|
|
1324
1245
|
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1246
|
+
clear(matcher) {
|
|
1247
|
+
const keys = Object.keys(this);
|
|
1248
|
+
let i = keys.length;
|
|
1249
|
+
let deleted = false;
|
|
1250
|
+
|
|
1251
|
+
while (i--) {
|
|
1252
|
+
const key = keys[i];
|
|
1253
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1254
|
+
delete this[key];
|
|
1255
|
+
deleted = true;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
return deleted;
|
|
1337
1260
|
}
|
|
1338
1261
|
|
|
1339
|
-
|
|
1262
|
+
normalize(format) {
|
|
1263
|
+
const self = this;
|
|
1264
|
+
const headers = {};
|
|
1340
1265
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1266
|
+
utils$1.forEach(this, (value, header) => {
|
|
1267
|
+
const key = utils$1.findKey(headers, header);
|
|
1268
|
+
|
|
1269
|
+
if (key) {
|
|
1270
|
+
self[key] = normalizeValue(value);
|
|
1271
|
+
delete self[header];
|
|
1272
|
+
return;
|
|
1344
1273
|
}
|
|
1345
|
-
: options;
|
|
1346
1274
|
|
|
1347
|
-
|
|
1275
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1348
1276
|
|
|
1349
|
-
|
|
1277
|
+
if (normalized !== header) {
|
|
1278
|
+
delete self[header];
|
|
1279
|
+
}
|
|
1350
1280
|
|
|
1351
|
-
|
|
1352
|
-
serializedParams = serializeFn(params, _options);
|
|
1353
|
-
} else {
|
|
1354
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
1355
|
-
? params.toString()
|
|
1356
|
-
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1357
|
-
}
|
|
1281
|
+
self[normalized] = normalizeValue(value);
|
|
1358
1282
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1283
|
+
headers[normalized] = true;
|
|
1284
|
+
});
|
|
1361
1285
|
|
|
1362
|
-
|
|
1363
|
-
url = url.slice(0, hashmarkIndex);
|
|
1364
|
-
}
|
|
1365
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1286
|
+
return this;
|
|
1366
1287
|
}
|
|
1367
1288
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
class InterceptorManager {
|
|
1372
|
-
constructor() {
|
|
1373
|
-
this.handlers = [];
|
|
1289
|
+
concat(...targets) {
|
|
1290
|
+
return this.constructor.concat(this, ...targets);
|
|
1374
1291
|
}
|
|
1375
1292
|
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
* @return {Number} An ID used to remove interceptor later
|
|
1384
|
-
*/
|
|
1385
|
-
use(fulfilled, rejected, options) {
|
|
1386
|
-
this.handlers.push({
|
|
1387
|
-
fulfilled,
|
|
1388
|
-
rejected,
|
|
1389
|
-
synchronous: options ? options.synchronous : false,
|
|
1390
|
-
runWhen: options ? options.runWhen : null,
|
|
1293
|
+
toJSON(asStrings) {
|
|
1294
|
+
const obj = Object.create(null);
|
|
1295
|
+
|
|
1296
|
+
utils$1.forEach(this, (value, header) => {
|
|
1297
|
+
value != null &&
|
|
1298
|
+
value !== false &&
|
|
1299
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1391
1300
|
});
|
|
1392
|
-
return this.handlers.length - 1;
|
|
1393
|
-
}
|
|
1394
1301
|
|
|
1395
|
-
|
|
1396
|
-
* Remove an interceptor from the stack
|
|
1397
|
-
*
|
|
1398
|
-
* @param {Number} id The ID that was returned by `use`
|
|
1399
|
-
*
|
|
1400
|
-
* @returns {void}
|
|
1401
|
-
*/
|
|
1402
|
-
eject(id) {
|
|
1403
|
-
if (this.handlers[id]) {
|
|
1404
|
-
this.handlers[id] = null;
|
|
1405
|
-
}
|
|
1302
|
+
return obj;
|
|
1406
1303
|
}
|
|
1407
1304
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
*
|
|
1411
|
-
* @returns {void}
|
|
1412
|
-
*/
|
|
1413
|
-
clear() {
|
|
1414
|
-
if (this.handlers) {
|
|
1415
|
-
this.handlers = [];
|
|
1416
|
-
}
|
|
1305
|
+
[Symbol.iterator]() {
|
|
1306
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1417
1307
|
}
|
|
1418
1308
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
* interceptors that may have become `null` calling `eject`.
|
|
1424
|
-
*
|
|
1425
|
-
* @param {Function} fn The function to call for each interceptor
|
|
1426
|
-
*
|
|
1427
|
-
* @returns {void}
|
|
1428
|
-
*/
|
|
1429
|
-
forEach(fn) {
|
|
1430
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1431
|
-
if (h !== null) {
|
|
1432
|
-
fn(h);
|
|
1433
|
-
}
|
|
1434
|
-
});
|
|
1309
|
+
toString() {
|
|
1310
|
+
return Object.entries(this.toJSON())
|
|
1311
|
+
.map(([header, value]) => header + ': ' + value)
|
|
1312
|
+
.join('\n');
|
|
1435
1313
|
}
|
|
1436
|
-
}
|
|
1437
1314
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
clarifyTimeoutError: false,
|
|
1442
|
-
legacyInterceptorReqResOrdering: true,
|
|
1443
|
-
};
|
|
1315
|
+
getSetCookie() {
|
|
1316
|
+
return this.get('set-cookie') || [];
|
|
1317
|
+
}
|
|
1444
1318
|
|
|
1445
|
-
|
|
1319
|
+
get [Symbol.toStringTag]() {
|
|
1320
|
+
return 'AxiosHeaders';
|
|
1321
|
+
}
|
|
1446
1322
|
|
|
1447
|
-
|
|
1323
|
+
static from(thing) {
|
|
1324
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1325
|
+
}
|
|
1448
1326
|
|
|
1449
|
-
|
|
1327
|
+
static concat(first, ...targets) {
|
|
1328
|
+
const computed = new this(first);
|
|
1450
1329
|
|
|
1451
|
-
|
|
1452
|
-
isBrowser: true,
|
|
1453
|
-
classes: {
|
|
1454
|
-
URLSearchParams: URLSearchParams$1,
|
|
1455
|
-
FormData: FormData$1,
|
|
1456
|
-
Blob: Blob$1,
|
|
1457
|
-
},
|
|
1458
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
1459
|
-
};
|
|
1330
|
+
targets.forEach((target) => computed.set(target));
|
|
1460
1331
|
|
|
1461
|
-
|
|
1332
|
+
return computed;
|
|
1333
|
+
}
|
|
1462
1334
|
|
|
1463
|
-
|
|
1335
|
+
static accessor(header) {
|
|
1336
|
+
const internals =
|
|
1337
|
+
(this[$internals] =
|
|
1338
|
+
this[$internals] =
|
|
1339
|
+
{
|
|
1340
|
+
accessors: {},
|
|
1341
|
+
});
|
|
1464
1342
|
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
*
|
|
1468
|
-
* This allows axios to run in a web worker, and react-native.
|
|
1469
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
1470
|
-
*
|
|
1471
|
-
* web workers:
|
|
1472
|
-
* typeof window -> undefined
|
|
1473
|
-
* typeof document -> undefined
|
|
1474
|
-
*
|
|
1475
|
-
* react-native:
|
|
1476
|
-
* navigator.product -> 'ReactNative'
|
|
1477
|
-
* nativescript
|
|
1478
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
1479
|
-
*
|
|
1480
|
-
* @returns {boolean}
|
|
1481
|
-
*/
|
|
1482
|
-
const hasStandardBrowserEnv =
|
|
1483
|
-
hasBrowserEnv &&
|
|
1484
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
1343
|
+
const accessors = internals.accessors;
|
|
1344
|
+
const prototype = this.prototype;
|
|
1485
1345
|
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
*
|
|
1489
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
1490
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
1491
|
-
* filtered out due to its judgment standard
|
|
1492
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
1493
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
1494
|
-
*/
|
|
1495
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
1496
|
-
return (
|
|
1497
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
1498
|
-
// eslint-disable-next-line no-undef
|
|
1499
|
-
self instanceof WorkerGlobalScope &&
|
|
1500
|
-
typeof self.importScripts === 'function'
|
|
1501
|
-
);
|
|
1502
|
-
})();
|
|
1346
|
+
function defineAccessor(_header) {
|
|
1347
|
+
const lHeader = normalizeHeader(_header);
|
|
1503
1348
|
|
|
1504
|
-
|
|
1349
|
+
if (!accessors[lHeader]) {
|
|
1350
|
+
buildAccessors(prototype, _header);
|
|
1351
|
+
accessors[lHeader] = true;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1505
1354
|
|
|
1506
|
-
|
|
1507
|
-
__proto__: null,
|
|
1508
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
1509
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
1510
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
1511
|
-
navigator: _navigator,
|
|
1512
|
-
origin: origin
|
|
1513
|
-
});
|
|
1355
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1514
1356
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
...platform$1,
|
|
1357
|
+
return this;
|
|
1358
|
+
}
|
|
1518
1359
|
};
|
|
1519
1360
|
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1361
|
+
AxiosHeaders$1.accessor([
|
|
1362
|
+
'Content-Type',
|
|
1363
|
+
'Content-Length',
|
|
1364
|
+
'Accept',
|
|
1365
|
+
'Accept-Encoding',
|
|
1366
|
+
'User-Agent',
|
|
1367
|
+
'Authorization',
|
|
1368
|
+
]);
|
|
1527
1369
|
|
|
1528
|
-
|
|
1370
|
+
// reserved names hotfix
|
|
1371
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
1372
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
1373
|
+
return {
|
|
1374
|
+
get: () => value,
|
|
1375
|
+
set(headerValue) {
|
|
1376
|
+
this[mapped] = headerValue;
|
|
1529
1377
|
},
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
}
|
|
1378
|
+
};
|
|
1379
|
+
});
|
|
1533
1380
|
|
|
1534
|
-
|
|
1535
|
-
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
1536
|
-
*
|
|
1537
|
-
* @param {string} name - The name of the property to get.
|
|
1538
|
-
*
|
|
1539
|
-
* @returns An array of strings.
|
|
1540
|
-
*/
|
|
1541
|
-
function parsePropPath(name) {
|
|
1542
|
-
// foo[x][y][z]
|
|
1543
|
-
// foo.x.y.z
|
|
1544
|
-
// foo-x-y-z
|
|
1545
|
-
// foo x y z
|
|
1546
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1547
|
-
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1548
|
-
});
|
|
1549
|
-
}
|
|
1381
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
1550
1382
|
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
* @returns An object with the same keys and values as the array.
|
|
1557
|
-
*/
|
|
1558
|
-
function arrayToObject(arr) {
|
|
1559
|
-
const obj = {};
|
|
1560
|
-
const keys = Object.keys(arr);
|
|
1561
|
-
let i;
|
|
1562
|
-
const len = keys.length;
|
|
1563
|
-
let key;
|
|
1564
|
-
for (i = 0; i < len; i++) {
|
|
1565
|
-
key = keys[i];
|
|
1566
|
-
obj[key] = arr[key];
|
|
1383
|
+
const REDACTED = '[REDACTED ****]';
|
|
1384
|
+
|
|
1385
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
1386
|
+
if (utils$1.hasOwnProp(source, 'toJSON')) {
|
|
1387
|
+
return true;
|
|
1567
1388
|
}
|
|
1568
|
-
|
|
1389
|
+
|
|
1390
|
+
let prototype = Object.getPrototypeOf(source);
|
|
1391
|
+
|
|
1392
|
+
while (prototype && prototype !== Object.prototype) {
|
|
1393
|
+
if (utils$1.hasOwnProp(prototype, 'toJSON')) {
|
|
1394
|
+
return true;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
return false;
|
|
1569
1401
|
}
|
|
1570
1402
|
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
*/
|
|
1578
|
-
function formDataToJSON(formData) {
|
|
1579
|
-
function buildPath(path, value, target, index) {
|
|
1580
|
-
let name = path[index++];
|
|
1403
|
+
// Build a plain-object snapshot of `config` and replace the value of any key
|
|
1404
|
+
// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
|
|
1405
|
+
// and AxiosHeaders, and short-circuits on circular references.
|
|
1406
|
+
function redactConfig(config, redactKeys) {
|
|
1407
|
+
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
1408
|
+
const seen = [];
|
|
1581
1409
|
|
|
1582
|
-
|
|
1410
|
+
const visit = (source) => {
|
|
1411
|
+
if (source === null || typeof source !== 'object') return source;
|
|
1412
|
+
if (utils$1.isBuffer(source)) return source;
|
|
1413
|
+
if (seen.indexOf(source) !== -1) return undefined;
|
|
1583
1414
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1415
|
+
if (source instanceof AxiosHeaders$1) {
|
|
1416
|
+
source = source.toJSON();
|
|
1417
|
+
}
|
|
1587
1418
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1419
|
+
seen.push(source);
|
|
1420
|
+
|
|
1421
|
+
let result;
|
|
1422
|
+
if (utils$1.isArray(source)) {
|
|
1423
|
+
result = [];
|
|
1424
|
+
source.forEach((v, i) => {
|
|
1425
|
+
const reducedValue = visit(v);
|
|
1426
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
1427
|
+
result[i] = reducedValue;
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
} else {
|
|
1431
|
+
if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
1432
|
+
seen.pop();
|
|
1433
|
+
return source;
|
|
1593
1434
|
}
|
|
1594
1435
|
|
|
1595
|
-
|
|
1436
|
+
result = Object.create(null);
|
|
1437
|
+
for (const [key, value] of Object.entries(source)) {
|
|
1438
|
+
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
1439
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
1440
|
+
result[key] = reducedValue;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1596
1443
|
}
|
|
1597
1444
|
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1445
|
+
seen.pop();
|
|
1446
|
+
return result;
|
|
1447
|
+
};
|
|
1601
1448
|
|
|
1602
|
-
|
|
1449
|
+
return visit(config);
|
|
1450
|
+
}
|
|
1603
1451
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1452
|
+
let AxiosError$1 = class AxiosError extends Error {
|
|
1453
|
+
static from(error, code, config, request, response, customProps) {
|
|
1454
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1455
|
+
axiosError.cause = error;
|
|
1456
|
+
axiosError.name = error.name;
|
|
1457
|
+
|
|
1458
|
+
// Preserve status from the original error if not already set from response
|
|
1459
|
+
if (error.status != null && axiosError.status == null) {
|
|
1460
|
+
axiosError.status = error.status;
|
|
1606
1461
|
}
|
|
1607
1462
|
|
|
1608
|
-
|
|
1463
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1464
|
+
return axiosError;
|
|
1609
1465
|
}
|
|
1610
1466
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1467
|
+
/**
|
|
1468
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1469
|
+
*
|
|
1470
|
+
* @param {string} message The error message.
|
|
1471
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1472
|
+
* @param {Object} [config] The config.
|
|
1473
|
+
* @param {Object} [request] The request.
|
|
1474
|
+
* @param {Object} [response] The response.
|
|
1475
|
+
*
|
|
1476
|
+
* @returns {Error} The created error.
|
|
1477
|
+
*/
|
|
1478
|
+
constructor(message, code, config, request, response) {
|
|
1479
|
+
super(message);
|
|
1480
|
+
|
|
1481
|
+
// Make message enumerable to maintain backward compatibility
|
|
1482
|
+
// The native Error constructor sets message as non-enumerable,
|
|
1483
|
+
// but axios < v1.13.3 had it as enumerable
|
|
1484
|
+
Object.defineProperty(this, 'message', {
|
|
1485
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1486
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
1487
|
+
__proto__: null,
|
|
1488
|
+
value: message,
|
|
1489
|
+
enumerable: true,
|
|
1490
|
+
writable: true,
|
|
1491
|
+
configurable: true,
|
|
1616
1492
|
});
|
|
1617
1493
|
|
|
1618
|
-
|
|
1494
|
+
this.name = 'AxiosError';
|
|
1495
|
+
this.isAxiosError = true;
|
|
1496
|
+
code && (this.code = code);
|
|
1497
|
+
config && (this.config = config);
|
|
1498
|
+
request && (this.request = request);
|
|
1499
|
+
if (response) {
|
|
1500
|
+
this.response = response;
|
|
1501
|
+
this.status = response.status;
|
|
1502
|
+
}
|
|
1619
1503
|
}
|
|
1620
1504
|
|
|
1621
|
-
|
|
1505
|
+
toJSON() {
|
|
1506
|
+
// Opt-in redaction: when the request config carries a `redact` array, the
|
|
1507
|
+
// value of any matching key (case-insensitive, at any depth) is replaced
|
|
1508
|
+
// with REDACTED in the serialized snapshot. Undefined or empty leaves the
|
|
1509
|
+
// existing serialization behavior unchanged.
|
|
1510
|
+
const config = this.config;
|
|
1511
|
+
const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
|
|
1512
|
+
const serializedConfig =
|
|
1513
|
+
utils$1.isArray(redactKeys) && redactKeys.length > 0
|
|
1514
|
+
? redactConfig(config, redactKeys)
|
|
1515
|
+
: utils$1.toJSONObject(config);
|
|
1516
|
+
|
|
1517
|
+
return {
|
|
1518
|
+
// Standard
|
|
1519
|
+
message: this.message,
|
|
1520
|
+
name: this.name,
|
|
1521
|
+
// Microsoft
|
|
1522
|
+
description: this.description,
|
|
1523
|
+
number: this.number,
|
|
1524
|
+
// Mozilla
|
|
1525
|
+
fileName: this.fileName,
|
|
1526
|
+
lineNumber: this.lineNumber,
|
|
1527
|
+
columnNumber: this.columnNumber,
|
|
1528
|
+
stack: this.stack,
|
|
1529
|
+
// Axios
|
|
1530
|
+
config: serializedConfig,
|
|
1531
|
+
code: this.code,
|
|
1532
|
+
status: this.status,
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
1538
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
1539
|
+
AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1540
|
+
AxiosError$1.ECONNABORTED = 'ECONNABORTED';
|
|
1541
|
+
AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
|
|
1542
|
+
AxiosError$1.ECONNREFUSED = 'ECONNREFUSED';
|
|
1543
|
+
AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
|
|
1544
|
+
AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1545
|
+
AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1546
|
+
AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1547
|
+
AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1548
|
+
AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
|
|
1549
|
+
AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1550
|
+
AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1551
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
1552
|
+
|
|
1553
|
+
// eslint-disable-next-line strict
|
|
1554
|
+
var httpAdapter = null;
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Determines if the given thing is a array or js object.
|
|
1558
|
+
*
|
|
1559
|
+
* @param {string} thing - The object or array to be visited.
|
|
1560
|
+
*
|
|
1561
|
+
* @returns {boolean}
|
|
1562
|
+
*/
|
|
1563
|
+
function isVisitable(thing) {
|
|
1564
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
1622
1565
|
}
|
|
1623
1566
|
|
|
1624
1567
|
/**
|
|
1625
|
-
* It
|
|
1626
|
-
* of the input
|
|
1568
|
+
* It removes the brackets from the end of a string
|
|
1627
1569
|
*
|
|
1628
|
-
* @param {
|
|
1629
|
-
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
1630
|
-
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
1570
|
+
* @param {string} key - The key of the parameter.
|
|
1631
1571
|
*
|
|
1632
|
-
* @returns {string}
|
|
1572
|
+
* @returns {string} the key without the brackets.
|
|
1633
1573
|
*/
|
|
1634
|
-
function
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
(parser || JSON.parse)(rawValue);
|
|
1638
|
-
return utils$1.trim(rawValue);
|
|
1639
|
-
} catch (e) {
|
|
1640
|
-
if (e.name !== 'SyntaxError') {
|
|
1641
|
-
throw e;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1574
|
+
function removeBrackets(key) {
|
|
1575
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
1576
|
+
}
|
|
1645
1577
|
|
|
1646
|
-
|
|
1578
|
+
/**
|
|
1579
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
1580
|
+
*
|
|
1581
|
+
* @param {string} path - The path to the current key.
|
|
1582
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
1583
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
1584
|
+
*
|
|
1585
|
+
* @returns {string} The path to the current key.
|
|
1586
|
+
*/
|
|
1587
|
+
function renderKey(path, key, dots) {
|
|
1588
|
+
if (!path) return key;
|
|
1589
|
+
return path
|
|
1590
|
+
.concat(key)
|
|
1591
|
+
.map(function each(token, i) {
|
|
1592
|
+
// eslint-disable-next-line no-param-reassign
|
|
1593
|
+
token = removeBrackets(token);
|
|
1594
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
1595
|
+
})
|
|
1596
|
+
.join(dots ? '.' : '');
|
|
1647
1597
|
}
|
|
1648
1598
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1599
|
+
/**
|
|
1600
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
1601
|
+
*
|
|
1602
|
+
* @param {Array<any>} arr - The array to check
|
|
1603
|
+
*
|
|
1604
|
+
* @returns {boolean}
|
|
1605
|
+
*/
|
|
1606
|
+
function isFlatArray(arr) {
|
|
1607
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
1608
|
+
}
|
|
1651
1609
|
|
|
1652
|
-
|
|
1610
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
1611
|
+
return /^is[A-Z]/.test(prop);
|
|
1612
|
+
});
|
|
1653
1613
|
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1614
|
+
/**
|
|
1615
|
+
* Convert a data object to FormData
|
|
1616
|
+
*
|
|
1617
|
+
* @param {Object} obj
|
|
1618
|
+
* @param {?Object} [formData]
|
|
1619
|
+
* @param {?Object} [options]
|
|
1620
|
+
* @param {Function} [options.visitor]
|
|
1621
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
1622
|
+
* @param {Boolean} [options.dots = false]
|
|
1623
|
+
* @param {?Boolean} [options.indexes = false]
|
|
1624
|
+
*
|
|
1625
|
+
* @returns {Object}
|
|
1626
|
+
**/
|
|
1659
1627
|
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1628
|
+
/**
|
|
1629
|
+
* It converts an object into a FormData object
|
|
1630
|
+
*
|
|
1631
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
1632
|
+
* @param {string} formData - The FormData object to append to.
|
|
1633
|
+
* @param {Object<string, any>} options
|
|
1634
|
+
*
|
|
1635
|
+
* @returns
|
|
1636
|
+
*/
|
|
1637
|
+
function toFormData$1(obj, formData, options) {
|
|
1638
|
+
if (!utils$1.isObject(obj)) {
|
|
1639
|
+
throw new TypeError('target must be an object');
|
|
1640
|
+
}
|
|
1663
1641
|
|
|
1664
|
-
|
|
1642
|
+
// eslint-disable-next-line no-param-reassign
|
|
1643
|
+
formData = formData || new (FormData)();
|
|
1665
1644
|
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1645
|
+
// eslint-disable-next-line no-param-reassign
|
|
1646
|
+
options = utils$1.toFlatObject(
|
|
1647
|
+
options,
|
|
1648
|
+
{
|
|
1649
|
+
metaTokens: true,
|
|
1650
|
+
dots: false,
|
|
1651
|
+
indexes: false,
|
|
1652
|
+
},
|
|
1653
|
+
false,
|
|
1654
|
+
function defined(option, source) {
|
|
1655
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1656
|
+
return !utils$1.isUndefined(source[option]);
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1669
1659
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
return data;
|
|
1679
|
-
}
|
|
1680
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
1681
|
-
return data.buffer;
|
|
1682
|
-
}
|
|
1683
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
1684
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1685
|
-
return data.toString();
|
|
1686
|
-
}
|
|
1660
|
+
const metaTokens = options.metaTokens;
|
|
1661
|
+
// eslint-disable-next-line no-use-before-define
|
|
1662
|
+
const visitor = options.visitor || defaultVisitor;
|
|
1663
|
+
const dots = options.dots;
|
|
1664
|
+
const indexes = options.indexes;
|
|
1665
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1666
|
+
const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
1667
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1687
1668
|
|
|
1688
|
-
|
|
1669
|
+
if (!utils$1.isFunction(visitor)) {
|
|
1670
|
+
throw new TypeError('visitor must be a function');
|
|
1671
|
+
}
|
|
1689
1672
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1693
|
-
}
|
|
1673
|
+
function convertValue(value) {
|
|
1674
|
+
if (value === null) return '';
|
|
1694
1675
|
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
) {
|
|
1699
|
-
const _FormData = this.env && this.env.FormData;
|
|
1676
|
+
if (utils$1.isDate(value)) {
|
|
1677
|
+
return value.toISOString();
|
|
1678
|
+
}
|
|
1700
1679
|
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
this.formSerializer
|
|
1705
|
-
);
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1680
|
+
if (utils$1.isBoolean(value)) {
|
|
1681
|
+
return value.toString();
|
|
1682
|
+
}
|
|
1708
1683
|
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
}
|
|
1684
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
1685
|
+
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
1686
|
+
}
|
|
1713
1687
|
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1688
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1689
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1690
|
+
}
|
|
1717
1691
|
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
const transitional = this.transitional || defaults.transitional;
|
|
1721
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1722
|
-
const JSONRequested = this.responseType === 'json';
|
|
1692
|
+
return value;
|
|
1693
|
+
}
|
|
1723
1694
|
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1695
|
+
/**
|
|
1696
|
+
* Default visitor.
|
|
1697
|
+
*
|
|
1698
|
+
* @param {*} value
|
|
1699
|
+
* @param {String|Number} key
|
|
1700
|
+
* @param {Array<String|Number>} path
|
|
1701
|
+
* @this {FormData}
|
|
1702
|
+
*
|
|
1703
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1704
|
+
*/
|
|
1705
|
+
function defaultVisitor(value, key, path) {
|
|
1706
|
+
let arr = value;
|
|
1727
1707
|
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1708
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1709
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1710
|
+
return false;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
if (value && !path && typeof value === 'object') {
|
|
1714
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
1715
|
+
// eslint-disable-next-line no-param-reassign
|
|
1716
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
1717
|
+
// eslint-disable-next-line no-param-reassign
|
|
1718
|
+
value = JSON.stringify(value);
|
|
1719
|
+
} else if (
|
|
1720
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1721
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1732
1722
|
) {
|
|
1733
|
-
|
|
1734
|
-
|
|
1723
|
+
// eslint-disable-next-line no-param-reassign
|
|
1724
|
+
key = removeBrackets(key);
|
|
1735
1725
|
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1726
|
+
arr.forEach(function each(el, index) {
|
|
1727
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1728
|
+
formData.append(
|
|
1729
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1730
|
+
indexes === true
|
|
1731
|
+
? renderKey([key], index, dots)
|
|
1732
|
+
: indexes === null
|
|
1733
|
+
? key
|
|
1734
|
+
: key + '[]',
|
|
1735
|
+
convertValue(el)
|
|
1736
|
+
);
|
|
1737
|
+
});
|
|
1738
|
+
return false;
|
|
1746
1739
|
}
|
|
1740
|
+
}
|
|
1747
1741
|
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
/**
|
|
1753
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1754
|
-
* timeout is not created.
|
|
1755
|
-
*/
|
|
1756
|
-
timeout: 0,
|
|
1757
|
-
|
|
1758
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
1759
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
1742
|
+
if (isVisitable(value)) {
|
|
1743
|
+
return true;
|
|
1744
|
+
}
|
|
1760
1745
|
|
|
1761
|
-
|
|
1762
|
-
maxBodyLength: -1,
|
|
1746
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1763
1747
|
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
Blob: platform.classes.Blob,
|
|
1767
|
-
},
|
|
1748
|
+
return false;
|
|
1749
|
+
}
|
|
1768
1750
|
|
|
1769
|
-
|
|
1770
|
-
return status >= 200 && status < 300;
|
|
1771
|
-
},
|
|
1751
|
+
const stack = [];
|
|
1772
1752
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
},
|
|
1779
|
-
};
|
|
1753
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
1754
|
+
defaultVisitor,
|
|
1755
|
+
convertValue,
|
|
1756
|
+
isVisitable,
|
|
1757
|
+
});
|
|
1780
1758
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
});
|
|
1759
|
+
function build(value, path, depth = 0) {
|
|
1760
|
+
if (utils$1.isUndefined(value)) return;
|
|
1784
1761
|
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
'content-type',
|
|
1792
|
-
'etag',
|
|
1793
|
-
'expires',
|
|
1794
|
-
'from',
|
|
1795
|
-
'host',
|
|
1796
|
-
'if-modified-since',
|
|
1797
|
-
'if-unmodified-since',
|
|
1798
|
-
'last-modified',
|
|
1799
|
-
'location',
|
|
1800
|
-
'max-forwards',
|
|
1801
|
-
'proxy-authorization',
|
|
1802
|
-
'referer',
|
|
1803
|
-
'retry-after',
|
|
1804
|
-
'user-agent',
|
|
1805
|
-
]);
|
|
1762
|
+
if (depth > maxDepth) {
|
|
1763
|
+
throw new AxiosError$1(
|
|
1764
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
1765
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1766
|
+
);
|
|
1767
|
+
}
|
|
1806
1768
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
* ```
|
|
1811
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
1812
|
-
* Content-Type: application/json
|
|
1813
|
-
* Connection: keep-alive
|
|
1814
|
-
* Transfer-Encoding: chunked
|
|
1815
|
-
* ```
|
|
1816
|
-
*
|
|
1817
|
-
* @param {String} rawHeaders Headers needing to be parsed
|
|
1818
|
-
*
|
|
1819
|
-
* @returns {Object} Headers parsed into an object
|
|
1820
|
-
*/
|
|
1821
|
-
var parseHeaders = (rawHeaders) => {
|
|
1822
|
-
const parsed = {};
|
|
1823
|
-
let key;
|
|
1824
|
-
let val;
|
|
1825
|
-
let i;
|
|
1769
|
+
if (stack.indexOf(value) !== -1) {
|
|
1770
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1771
|
+
}
|
|
1826
1772
|
|
|
1827
|
-
|
|
1828
|
-
rawHeaders.split('\n').forEach(function parser(line) {
|
|
1829
|
-
i = line.indexOf(':');
|
|
1830
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
1831
|
-
val = line.substring(i + 1).trim();
|
|
1773
|
+
stack.push(value);
|
|
1832
1774
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1775
|
+
utils$1.forEach(value, function each(el, key) {
|
|
1776
|
+
const result =
|
|
1777
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1778
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1836
1779
|
|
|
1837
|
-
if (
|
|
1838
|
-
|
|
1839
|
-
parsed[key].push(val);
|
|
1840
|
-
} else {
|
|
1841
|
-
parsed[key] = [val];
|
|
1842
|
-
}
|
|
1843
|
-
} else {
|
|
1844
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1780
|
+
if (result === true) {
|
|
1781
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
1845
1782
|
}
|
|
1846
1783
|
});
|
|
1847
1784
|
|
|
1848
|
-
|
|
1849
|
-
};
|
|
1850
|
-
|
|
1851
|
-
const $internals = Symbol('internals');
|
|
1852
|
-
|
|
1853
|
-
const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
1854
|
-
|
|
1855
|
-
function assertValidHeaderValue(value, header) {
|
|
1856
|
-
if (value === false || value == null) {
|
|
1857
|
-
return;
|
|
1785
|
+
stack.pop();
|
|
1858
1786
|
}
|
|
1859
1787
|
|
|
1860
|
-
if (utils$1.
|
|
1861
|
-
|
|
1862
|
-
return;
|
|
1788
|
+
if (!utils$1.isObject(obj)) {
|
|
1789
|
+
throw new TypeError('data must be an object');
|
|
1863
1790
|
}
|
|
1864
1791
|
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1792
|
+
build(obj);
|
|
1793
|
+
|
|
1794
|
+
return formData;
|
|
1868
1795
|
}
|
|
1869
1796
|
|
|
1870
|
-
|
|
1871
|
-
|
|
1797
|
+
/**
|
|
1798
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
1799
|
+
* their percent-encoded equivalents
|
|
1800
|
+
*
|
|
1801
|
+
* @param {string} str - The string to encode.
|
|
1802
|
+
*
|
|
1803
|
+
* @returns {string} The encoded string.
|
|
1804
|
+
*/
|
|
1805
|
+
function encode$1(str) {
|
|
1806
|
+
const charMap = {
|
|
1807
|
+
'!': '%21',
|
|
1808
|
+
"'": '%27',
|
|
1809
|
+
'(': '%28',
|
|
1810
|
+
')': '%29',
|
|
1811
|
+
'~': '%7E',
|
|
1812
|
+
'%20': '+',
|
|
1813
|
+
};
|
|
1814
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
1815
|
+
return charMap[match];
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* It takes a params object and converts it to a FormData object
|
|
1821
|
+
*
|
|
1822
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1823
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1824
|
+
*
|
|
1825
|
+
* @returns {void}
|
|
1826
|
+
*/
|
|
1827
|
+
function AxiosURLSearchParams(params, options) {
|
|
1828
|
+
this._pairs = [];
|
|
1829
|
+
|
|
1830
|
+
params && toFormData$1(params, this, options);
|
|
1872
1831
|
}
|
|
1873
1832
|
|
|
1874
|
-
|
|
1875
|
-
let end = str.length;
|
|
1833
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
1876
1834
|
|
|
1877
|
-
|
|
1878
|
-
|
|
1835
|
+
prototype.append = function append(name, value) {
|
|
1836
|
+
this._pairs.push([name, value]);
|
|
1837
|
+
};
|
|
1879
1838
|
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1839
|
+
prototype.toString = function toString(encoder) {
|
|
1840
|
+
const _encode = encoder
|
|
1841
|
+
? function (value) {
|
|
1842
|
+
return encoder.call(this, value, encode$1);
|
|
1843
|
+
}
|
|
1844
|
+
: encode$1;
|
|
1883
1845
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1846
|
+
return this._pairs
|
|
1847
|
+
.map(function each(pair) {
|
|
1848
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1849
|
+
}, '')
|
|
1850
|
+
.join('&');
|
|
1851
|
+
};
|
|
1886
1852
|
|
|
1887
|
-
|
|
1853
|
+
/**
|
|
1854
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1855
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1856
|
+
*
|
|
1857
|
+
* @param {string} val The value to be encoded.
|
|
1858
|
+
*
|
|
1859
|
+
* @returns {string} The encoded value.
|
|
1860
|
+
*/
|
|
1861
|
+
function encode(val) {
|
|
1862
|
+
return encodeURIComponent(val)
|
|
1863
|
+
.replace(/%3A/gi, ':')
|
|
1864
|
+
.replace(/%24/g, '$')
|
|
1865
|
+
.replace(/%2C/gi, ',')
|
|
1866
|
+
.replace(/%20/g, '+');
|
|
1888
1867
|
}
|
|
1889
1868
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1869
|
+
/**
|
|
1870
|
+
* Build a URL by appending params to the end
|
|
1871
|
+
*
|
|
1872
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
1873
|
+
* @param {object} [params] The params to be appended
|
|
1874
|
+
* @param {?(object|Function)} options
|
|
1875
|
+
*
|
|
1876
|
+
* @returns {string} The formatted url
|
|
1877
|
+
*/
|
|
1878
|
+
function buildURL(url, params, options) {
|
|
1879
|
+
if (!params) {
|
|
1880
|
+
return url;
|
|
1893
1881
|
}
|
|
1894
1882
|
|
|
1895
|
-
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
function parseTokens(str) {
|
|
1899
|
-
const tokens = Object.create(null);
|
|
1900
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1901
|
-
let match;
|
|
1883
|
+
const _encode = (options && options.encode) || encode;
|
|
1902
1884
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1885
|
+
const _options = utils$1.isFunction(options)
|
|
1886
|
+
? {
|
|
1887
|
+
serialize: options,
|
|
1888
|
+
}
|
|
1889
|
+
: options;
|
|
1906
1890
|
|
|
1907
|
-
|
|
1908
|
-
}
|
|
1891
|
+
const serializeFn = _options && _options.serialize;
|
|
1909
1892
|
|
|
1910
|
-
|
|
1893
|
+
let serializedParams;
|
|
1911
1894
|
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1895
|
+
if (serializeFn) {
|
|
1896
|
+
serializedParams = serializeFn(params, _options);
|
|
1897
|
+
} else {
|
|
1898
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
1899
|
+
? params.toString()
|
|
1900
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1915
1901
|
}
|
|
1916
1902
|
|
|
1917
|
-
if (
|
|
1918
|
-
|
|
1903
|
+
if (serializedParams) {
|
|
1904
|
+
const hashmarkIndex = url.indexOf('#');
|
|
1905
|
+
|
|
1906
|
+
if (hashmarkIndex !== -1) {
|
|
1907
|
+
url = url.slice(0, hashmarkIndex);
|
|
1908
|
+
}
|
|
1909
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1919
1910
|
}
|
|
1920
1911
|
|
|
1921
|
-
|
|
1912
|
+
return url;
|
|
1913
|
+
}
|
|
1922
1914
|
|
|
1923
|
-
|
|
1924
|
-
|
|
1915
|
+
class InterceptorManager {
|
|
1916
|
+
constructor() {
|
|
1917
|
+
this.handlers = [];
|
|
1925
1918
|
}
|
|
1926
1919
|
|
|
1927
|
-
|
|
1928
|
-
|
|
1920
|
+
/**
|
|
1921
|
+
* Add a new interceptor to the stack
|
|
1922
|
+
*
|
|
1923
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1924
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1925
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1926
|
+
*
|
|
1927
|
+
* @return {Number} An ID used to remove interceptor later
|
|
1928
|
+
*/
|
|
1929
|
+
use(fulfilled, rejected, options) {
|
|
1930
|
+
this.handlers.push({
|
|
1931
|
+
fulfilled,
|
|
1932
|
+
rejected,
|
|
1933
|
+
synchronous: options ? options.synchronous : false,
|
|
1934
|
+
runWhen: options ? options.runWhen : null,
|
|
1935
|
+
});
|
|
1936
|
+
return this.handlers.length - 1;
|
|
1929
1937
|
}
|
|
1930
|
-
}
|
|
1931
1938
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1939
|
+
/**
|
|
1940
|
+
* Remove an interceptor from the stack
|
|
1941
|
+
*
|
|
1942
|
+
* @param {Number} id The ID that was returned by `use`
|
|
1943
|
+
*
|
|
1944
|
+
* @returns {void}
|
|
1945
|
+
*/
|
|
1946
|
+
eject(id) {
|
|
1947
|
+
if (this.handlers[id]) {
|
|
1948
|
+
this.handlers[id] = null;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1940
1951
|
|
|
1941
|
-
|
|
1942
|
-
|
|
1952
|
+
/**
|
|
1953
|
+
* Clear all interceptors from the stack
|
|
1954
|
+
*
|
|
1955
|
+
* @returns {void}
|
|
1956
|
+
*/
|
|
1957
|
+
clear() {
|
|
1958
|
+
if (this.handlers) {
|
|
1959
|
+
this.handlers = [];
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1943
1962
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1963
|
+
/**
|
|
1964
|
+
* Iterate over all the registered interceptors
|
|
1965
|
+
*
|
|
1966
|
+
* This method is particularly useful for skipping over any
|
|
1967
|
+
* interceptors that may have become `null` calling `eject`.
|
|
1968
|
+
*
|
|
1969
|
+
* @param {Function} fn The function to call for each interceptor
|
|
1970
|
+
*
|
|
1971
|
+
* @returns {void}
|
|
1972
|
+
*/
|
|
1973
|
+
forEach(fn) {
|
|
1974
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1975
|
+
if (h !== null) {
|
|
1976
|
+
fn(h);
|
|
1977
|
+
}
|
|
1950
1978
|
});
|
|
1951
|
-
}
|
|
1979
|
+
}
|
|
1952
1980
|
}
|
|
1953
1981
|
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1982
|
+
var transitionalDefaults = {
|
|
1983
|
+
silentJSONParsing: true,
|
|
1984
|
+
forcedJSONParsing: true,
|
|
1985
|
+
clarifyTimeoutError: false,
|
|
1986
|
+
legacyInterceptorReqResOrdering: true,
|
|
1987
|
+
};
|
|
1958
1988
|
|
|
1959
|
-
|
|
1960
|
-
const self = this;
|
|
1989
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
1961
1990
|
|
|
1962
|
-
|
|
1963
|
-
const lHeader = normalizeHeader(_header);
|
|
1991
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
1964
1992
|
|
|
1965
|
-
|
|
1966
|
-
throw new Error('header name must be a non-empty string');
|
|
1967
|
-
}
|
|
1993
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
1968
1994
|
|
|
1969
|
-
|
|
1995
|
+
var platform$1 = {
|
|
1996
|
+
isBrowser: true,
|
|
1997
|
+
classes: {
|
|
1998
|
+
URLSearchParams: URLSearchParams$1,
|
|
1999
|
+
FormData: FormData$1,
|
|
2000
|
+
Blob: Blob$1,
|
|
2001
|
+
},
|
|
2002
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
2003
|
+
};
|
|
1970
2004
|
|
|
1971
|
-
|
|
1972
|
-
!key ||
|
|
1973
|
-
self[key] === undefined ||
|
|
1974
|
-
_rewrite === true ||
|
|
1975
|
-
(_rewrite === undefined && self[key] !== false)
|
|
1976
|
-
) {
|
|
1977
|
-
assertValidHeaderValue(_value, _header);
|
|
1978
|
-
self[key || _header] = normalizeValue(_value);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
2005
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1981
2006
|
|
|
1982
|
-
|
|
1983
|
-
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
2007
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
1984
2008
|
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2009
|
+
/**
|
|
2010
|
+
* Determine if we're running in a standard browser environment
|
|
2011
|
+
*
|
|
2012
|
+
* This allows axios to run in a web worker, and react-native.
|
|
2013
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
2014
|
+
*
|
|
2015
|
+
* web workers:
|
|
2016
|
+
* typeof window -> undefined
|
|
2017
|
+
* typeof document -> undefined
|
|
2018
|
+
*
|
|
2019
|
+
* react-native:
|
|
2020
|
+
* navigator.product -> 'ReactNative'
|
|
2021
|
+
* nativescript
|
|
2022
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
2023
|
+
*
|
|
2024
|
+
* @returns {boolean}
|
|
2025
|
+
*/
|
|
2026
|
+
const hasStandardBrowserEnv =
|
|
2027
|
+
hasBrowserEnv &&
|
|
2028
|
+
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
2029
|
+
|
|
2030
|
+
/**
|
|
2031
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
2032
|
+
*
|
|
2033
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
2034
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
2035
|
+
* filtered out due to its judgment standard
|
|
2036
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
2037
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
2038
|
+
*/
|
|
2039
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
2040
|
+
return (
|
|
2041
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
2042
|
+
// eslint-disable-next-line no-undef
|
|
2043
|
+
self instanceof WorkerGlobalScope &&
|
|
2044
|
+
typeof self.importScripts === 'function'
|
|
2045
|
+
);
|
|
2046
|
+
})();
|
|
1997
2047
|
|
|
1998
|
-
|
|
1999
|
-
? utils$1.isArray(dest)
|
|
2000
|
-
? [...dest, entry[1]]
|
|
2001
|
-
: [dest, entry[1]]
|
|
2002
|
-
: entry[1];
|
|
2003
|
-
}
|
|
2048
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
2004
2049
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2050
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
2051
|
+
__proto__: null,
|
|
2052
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
2053
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2054
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2055
|
+
navigator: _navigator,
|
|
2056
|
+
origin: origin
|
|
2057
|
+
});
|
|
2009
2058
|
|
|
2010
|
-
|
|
2011
|
-
|
|
2059
|
+
var platform = {
|
|
2060
|
+
...utils,
|
|
2061
|
+
...platform$1,
|
|
2062
|
+
};
|
|
2012
2063
|
|
|
2013
|
-
|
|
2014
|
-
|
|
2064
|
+
function toURLEncodedForm(data, options) {
|
|
2065
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
2066
|
+
visitor: function (value, key, path, helpers) {
|
|
2067
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
2068
|
+
this.append(key, value.toString('base64'));
|
|
2069
|
+
return false;
|
|
2070
|
+
}
|
|
2015
2071
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2072
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
2073
|
+
},
|
|
2074
|
+
...options,
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2018
2077
|
|
|
2019
|
-
|
|
2020
|
-
|
|
2078
|
+
/**
|
|
2079
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
2080
|
+
*
|
|
2081
|
+
* @param {string} name - The name of the property to get.
|
|
2082
|
+
*
|
|
2083
|
+
* @returns An array of strings.
|
|
2084
|
+
*/
|
|
2085
|
+
function parsePropPath(name) {
|
|
2086
|
+
// foo[x][y][z]
|
|
2087
|
+
// foo.x.y.z
|
|
2088
|
+
// foo-x-y-z
|
|
2089
|
+
// foo x y z
|
|
2090
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
2091
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2021
2094
|
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2095
|
+
/**
|
|
2096
|
+
* Convert an array to an object.
|
|
2097
|
+
*
|
|
2098
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
2099
|
+
*
|
|
2100
|
+
* @returns An object with the same keys and values as the array.
|
|
2101
|
+
*/
|
|
2102
|
+
function arrayToObject(arr) {
|
|
2103
|
+
const obj = {};
|
|
2104
|
+
const keys = Object.keys(arr);
|
|
2105
|
+
let i;
|
|
2106
|
+
const len = keys.length;
|
|
2107
|
+
let key;
|
|
2108
|
+
for (i = 0; i < len; i++) {
|
|
2109
|
+
key = keys[i];
|
|
2110
|
+
obj[key] = arr[key];
|
|
2111
|
+
}
|
|
2112
|
+
return obj;
|
|
2113
|
+
}
|
|
2025
2114
|
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2115
|
+
/**
|
|
2116
|
+
* It takes a FormData object and returns a JavaScript object
|
|
2117
|
+
*
|
|
2118
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
2119
|
+
*
|
|
2120
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
2121
|
+
*/
|
|
2122
|
+
function formDataToJSON(formData) {
|
|
2123
|
+
function buildPath(path, value, target, index) {
|
|
2124
|
+
let name = path[index++];
|
|
2029
2125
|
|
|
2030
|
-
|
|
2031
|
-
return parser.call(this, value, key);
|
|
2032
|
-
}
|
|
2126
|
+
if (name === '__proto__') return true;
|
|
2033
2127
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2128
|
+
const isNumericKey = Number.isFinite(+name);
|
|
2129
|
+
const isLast = index >= path.length;
|
|
2130
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
2037
2131
|
|
|
2038
|
-
|
|
2132
|
+
if (isLast) {
|
|
2133
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
2134
|
+
target[name] = utils$1.isArray(target[name])
|
|
2135
|
+
? target[name].concat(value)
|
|
2136
|
+
: [target[name], value];
|
|
2137
|
+
} else {
|
|
2138
|
+
target[name] = value;
|
|
2039
2139
|
}
|
|
2140
|
+
|
|
2141
|
+
return !isNumericKey;
|
|
2040
2142
|
}
|
|
2041
|
-
}
|
|
2042
2143
|
|
|
2043
|
-
|
|
2044
|
-
|
|
2144
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
2145
|
+
target[name] = [];
|
|
2146
|
+
}
|
|
2045
2147
|
|
|
2046
|
-
|
|
2047
|
-
const key = utils$1.findKey(this, header);
|
|
2148
|
+
const result = buildPath(path, value, target[name], index);
|
|
2048
2149
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
this[key] !== undefined &&
|
|
2052
|
-
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
2053
|
-
);
|
|
2150
|
+
if (result && utils$1.isArray(target[name])) {
|
|
2151
|
+
target[name] = arrayToObject(target[name]);
|
|
2054
2152
|
}
|
|
2055
2153
|
|
|
2056
|
-
return
|
|
2154
|
+
return !isNumericKey;
|
|
2057
2155
|
}
|
|
2058
2156
|
|
|
2059
|
-
|
|
2060
|
-
const
|
|
2061
|
-
let deleted = false;
|
|
2062
|
-
|
|
2063
|
-
function deleteHeader(_header) {
|
|
2064
|
-
_header = normalizeHeader(_header);
|
|
2065
|
-
|
|
2066
|
-
if (_header) {
|
|
2067
|
-
const key = utils$1.findKey(self, _header);
|
|
2068
|
-
|
|
2069
|
-
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
2070
|
-
delete self[key];
|
|
2071
|
-
|
|
2072
|
-
deleted = true;
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2157
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
2158
|
+
const obj = {};
|
|
2076
2159
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
}
|
|
2080
|
-
deleteHeader(header);
|
|
2081
|
-
}
|
|
2160
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
2161
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
2162
|
+
});
|
|
2082
2163
|
|
|
2083
|
-
return
|
|
2164
|
+
return obj;
|
|
2084
2165
|
}
|
|
2085
2166
|
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
let i = keys.length;
|
|
2089
|
-
let deleted = false;
|
|
2167
|
+
return null;
|
|
2168
|
+
}
|
|
2090
2169
|
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2170
|
+
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
2174
|
+
* of the input
|
|
2175
|
+
*
|
|
2176
|
+
* @param {any} rawValue - The value to be stringified.
|
|
2177
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
2178
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
2179
|
+
*
|
|
2180
|
+
* @returns {string} A stringified version of the rawValue.
|
|
2181
|
+
*/
|
|
2182
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
2183
|
+
if (utils$1.isString(rawValue)) {
|
|
2184
|
+
try {
|
|
2185
|
+
(parser || JSON.parse)(rawValue);
|
|
2186
|
+
return utils$1.trim(rawValue);
|
|
2187
|
+
} catch (e) {
|
|
2188
|
+
if (e.name !== 'SyntaxError') {
|
|
2189
|
+
throw e;
|
|
2096
2190
|
}
|
|
2097
2191
|
}
|
|
2098
|
-
|
|
2099
|
-
return deleted;
|
|
2100
2192
|
}
|
|
2101
2193
|
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
const headers = {};
|
|
2194
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
2195
|
+
}
|
|
2105
2196
|
|
|
2106
|
-
|
|
2107
|
-
|
|
2197
|
+
const defaults = {
|
|
2198
|
+
transitional: transitionalDefaults,
|
|
2108
2199
|
|
|
2109
|
-
|
|
2110
|
-
self[key] = normalizeValue(value);
|
|
2111
|
-
delete self[header];
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2200
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
2114
2201
|
|
|
2115
|
-
|
|
2202
|
+
transformRequest: [
|
|
2203
|
+
function transformRequest(data, headers) {
|
|
2204
|
+
const contentType = headers.getContentType() || '';
|
|
2205
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2206
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
2116
2207
|
|
|
2117
|
-
if (
|
|
2118
|
-
|
|
2208
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
2209
|
+
data = new FormData(data);
|
|
2119
2210
|
}
|
|
2120
2211
|
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
headers[normalized] = true;
|
|
2124
|
-
});
|
|
2212
|
+
const isFormData = utils$1.isFormData(data);
|
|
2125
2213
|
|
|
2126
|
-
|
|
2127
|
-
|
|
2214
|
+
if (isFormData) {
|
|
2215
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2216
|
+
}
|
|
2128
2217
|
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2218
|
+
if (
|
|
2219
|
+
utils$1.isArrayBuffer(data) ||
|
|
2220
|
+
utils$1.isBuffer(data) ||
|
|
2221
|
+
utils$1.isStream(data) ||
|
|
2222
|
+
utils$1.isFile(data) ||
|
|
2223
|
+
utils$1.isBlob(data) ||
|
|
2224
|
+
utils$1.isReadableStream(data)
|
|
2225
|
+
) {
|
|
2226
|
+
return data;
|
|
2227
|
+
}
|
|
2228
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
2229
|
+
return data.buffer;
|
|
2230
|
+
}
|
|
2231
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
2232
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2233
|
+
return data.toString();
|
|
2234
|
+
}
|
|
2132
2235
|
|
|
2133
|
-
|
|
2134
|
-
const obj = Object.create(null);
|
|
2236
|
+
let isFileList;
|
|
2135
2237
|
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2238
|
+
if (isObjectPayload) {
|
|
2239
|
+
const formSerializer = own(this, 'formSerializer');
|
|
2240
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2241
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
2242
|
+
}
|
|
2141
2243
|
|
|
2142
|
-
|
|
2143
|
-
|
|
2244
|
+
if (
|
|
2245
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
2246
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
2247
|
+
) {
|
|
2248
|
+
const env = own(this, 'env');
|
|
2249
|
+
const _FormData = env && env.FormData;
|
|
2144
2250
|
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2251
|
+
return toFormData$1(
|
|
2252
|
+
isFileList ? { 'files[]': data } : data,
|
|
2253
|
+
_FormData && new _FormData(),
|
|
2254
|
+
formSerializer
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2148
2258
|
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
}
|
|
2259
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2260
|
+
headers.setContentType('application/json', false);
|
|
2261
|
+
return stringifySafely(data);
|
|
2262
|
+
}
|
|
2154
2263
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2264
|
+
return data;
|
|
2265
|
+
},
|
|
2266
|
+
],
|
|
2158
2267
|
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2268
|
+
transformResponse: [
|
|
2269
|
+
function transformResponse(data) {
|
|
2270
|
+
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
2271
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2272
|
+
const responseType = own(this, 'responseType');
|
|
2273
|
+
const JSONRequested = responseType === 'json';
|
|
2162
2274
|
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2275
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2276
|
+
return data;
|
|
2277
|
+
}
|
|
2166
2278
|
|
|
2167
|
-
|
|
2168
|
-
|
|
2279
|
+
if (
|
|
2280
|
+
data &&
|
|
2281
|
+
utils$1.isString(data) &&
|
|
2282
|
+
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
2283
|
+
) {
|
|
2284
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2285
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2169
2286
|
|
|
2170
|
-
|
|
2287
|
+
try {
|
|
2288
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
2289
|
+
} catch (e) {
|
|
2290
|
+
if (strictJSONParsing) {
|
|
2291
|
+
if (e.name === 'SyntaxError') {
|
|
2292
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
2293
|
+
}
|
|
2294
|
+
throw e;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2171
2298
|
|
|
2172
|
-
|
|
2173
|
-
|
|
2299
|
+
return data;
|
|
2300
|
+
},
|
|
2301
|
+
],
|
|
2174
2302
|
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
accessors: {},
|
|
2181
|
-
});
|
|
2303
|
+
/**
|
|
2304
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2305
|
+
* timeout is not created.
|
|
2306
|
+
*/
|
|
2307
|
+
timeout: 0,
|
|
2182
2308
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2309
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
2310
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
2185
2311
|
|
|
2186
|
-
|
|
2187
|
-
|
|
2312
|
+
maxContentLength: -1,
|
|
2313
|
+
maxBodyLength: -1,
|
|
2188
2314
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
}
|
|
2315
|
+
env: {
|
|
2316
|
+
FormData: platform.classes.FormData,
|
|
2317
|
+
Blob: platform.classes.Blob,
|
|
2318
|
+
},
|
|
2194
2319
|
|
|
2195
|
-
|
|
2320
|
+
validateStatus: function validateStatus(status) {
|
|
2321
|
+
return status >= 200 && status < 300;
|
|
2322
|
+
},
|
|
2196
2323
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2324
|
+
headers: {
|
|
2325
|
+
common: {
|
|
2326
|
+
Accept: 'application/json, text/plain, */*',
|
|
2327
|
+
'Content-Type': undefined,
|
|
2328
|
+
},
|
|
2329
|
+
},
|
|
2199
2330
|
};
|
|
2200
2331
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
'Content-Length',
|
|
2204
|
-
'Accept',
|
|
2205
|
-
'Accept-Encoding',
|
|
2206
|
-
'User-Agent',
|
|
2207
|
-
'Authorization',
|
|
2208
|
-
]);
|
|
2209
|
-
|
|
2210
|
-
// reserved names hotfix
|
|
2211
|
-
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
2212
|
-
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2213
|
-
return {
|
|
2214
|
-
get: () => value,
|
|
2215
|
-
set(headerValue) {
|
|
2216
|
-
this[mapped] = headerValue;
|
|
2217
|
-
},
|
|
2218
|
-
};
|
|
2332
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
|
|
2333
|
+
defaults.headers[method] = {};
|
|
2219
2334
|
});
|
|
2220
2335
|
|
|
2221
|
-
utils$1.freezeMethods(AxiosHeaders$1);
|
|
2222
|
-
|
|
2223
2336
|
/**
|
|
2224
2337
|
* Transform the data for a request or a response
|
|
2225
2338
|
*
|
|
@@ -2278,22 +2391,18 @@ function settle(resolve, reject, response) {
|
|
|
2278
2391
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2279
2392
|
resolve(response);
|
|
2280
2393
|
} else {
|
|
2281
|
-
reject(
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
response.request,
|
|
2289
|
-
response
|
|
2290
|
-
)
|
|
2291
|
-
);
|
|
2394
|
+
reject(new AxiosError$1(
|
|
2395
|
+
'Request failed with status code ' + response.status,
|
|
2396
|
+
response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE,
|
|
2397
|
+
response.config,
|
|
2398
|
+
response.request,
|
|
2399
|
+
response
|
|
2400
|
+
));
|
|
2292
2401
|
}
|
|
2293
2402
|
}
|
|
2294
2403
|
|
|
2295
2404
|
function parseProtocol(url) {
|
|
2296
|
-
const match = /^([-+\w]{1,25})(
|
|
2405
|
+
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
2297
2406
|
return (match && match[1]) || '';
|
|
2298
2407
|
}
|
|
2299
2408
|
|
|
@@ -2397,13 +2506,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2397
2506
|
const _speedometer = speedometer(50, 250);
|
|
2398
2507
|
|
|
2399
2508
|
return throttle((e) => {
|
|
2400
|
-
const
|
|
2509
|
+
const rawLoaded = e.loaded;
|
|
2401
2510
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2402
|
-
const
|
|
2511
|
+
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
2512
|
+
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2403
2513
|
const rate = _speedometer(progressBytes);
|
|
2404
|
-
const inRange = loaded <= total;
|
|
2405
2514
|
|
|
2406
|
-
bytesNotified = loaded;
|
|
2515
|
+
bytesNotified = Math.max(bytesNotified, loaded);
|
|
2407
2516
|
|
|
2408
2517
|
const data = {
|
|
2409
2518
|
loaded,
|
|
@@ -2411,7 +2520,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2411
2520
|
progress: total ? loaded / total : undefined,
|
|
2412
2521
|
bytes: progressBytes,
|
|
2413
2522
|
rate: rate ? rate : undefined,
|
|
2414
|
-
estimated: rate && total
|
|
2523
|
+
estimated: rate && total ? (total - loaded) / rate : undefined,
|
|
2415
2524
|
event: e,
|
|
2416
2525
|
lengthComputable: total != null,
|
|
2417
2526
|
[isDownloadStream ? 'download' : 'upload']: true,
|
|
@@ -2484,8 +2593,20 @@ var cookies = platform.hasStandardBrowserEnv
|
|
|
2484
2593
|
|
|
2485
2594
|
read(name) {
|
|
2486
2595
|
if (typeof document === 'undefined') return null;
|
|
2487
|
-
|
|
2488
|
-
|
|
2596
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
2597
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
2598
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
2599
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
2600
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
2601
|
+
const cookies = document.cookie.split(';');
|
|
2602
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
2603
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
2604
|
+
const eq = cookie.indexOf('=');
|
|
2605
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
2606
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
return null;
|
|
2489
2610
|
},
|
|
2490
2611
|
|
|
2491
2612
|
remove(name) {
|
|
@@ -2545,7 +2666,7 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2545
2666
|
*/
|
|
2546
2667
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2547
2668
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2548
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls
|
|
2669
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
2549
2670
|
return combineURLs(baseURL, requestedURL);
|
|
2550
2671
|
}
|
|
2551
2672
|
return requestedURL;
|
|
@@ -2565,7 +2686,21 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing
|
|
|
2565
2686
|
function mergeConfig$1(config1, config2) {
|
|
2566
2687
|
// eslint-disable-next-line no-param-reassign
|
|
2567
2688
|
config2 = config2 || {};
|
|
2568
|
-
|
|
2689
|
+
|
|
2690
|
+
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
2691
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
2692
|
+
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
2693
|
+
// ergonomics for user code that relies on it.
|
|
2694
|
+
const config = Object.create(null);
|
|
2695
|
+
Object.defineProperty(config, 'hasOwnProperty', {
|
|
2696
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
2697
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
2698
|
+
__proto__: null,
|
|
2699
|
+
value: Object.prototype.hasOwnProperty,
|
|
2700
|
+
enumerable: false,
|
|
2701
|
+
writable: true,
|
|
2702
|
+
configurable: true,
|
|
2703
|
+
});
|
|
2569
2704
|
|
|
2570
2705
|
function getMergedValue(target, source, prop, caseless) {
|
|
2571
2706
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
@@ -2604,9 +2739,9 @@ function mergeConfig$1(config1, config2) {
|
|
|
2604
2739
|
|
|
2605
2740
|
// eslint-disable-next-line consistent-return
|
|
2606
2741
|
function mergeDirectKeys(a, b, prop) {
|
|
2607
|
-
if (prop
|
|
2742
|
+
if (utils$1.hasOwnProp(config2, prop)) {
|
|
2608
2743
|
return getMergedValue(a, b);
|
|
2609
|
-
} else if (prop
|
|
2744
|
+
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
2610
2745
|
return getMergedValue(undefined, a);
|
|
2611
2746
|
}
|
|
2612
2747
|
}
|
|
@@ -2638,6 +2773,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
2638
2773
|
httpsAgent: defaultToConfig2,
|
|
2639
2774
|
cancelToken: defaultToConfig2,
|
|
2640
2775
|
socketPath: defaultToConfig2,
|
|
2776
|
+
allowedSocketPaths: defaultToConfig2,
|
|
2641
2777
|
responseEncoding: defaultToConfig2,
|
|
2642
2778
|
validateStatus: mergeDirectKeys,
|
|
2643
2779
|
headers: (a, b, prop) =>
|
|
@@ -2647,22 +2783,64 @@ function mergeConfig$1(config1, config2) {
|
|
|
2647
2783
|
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2648
2784
|
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
2649
2785
|
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2650
|
-
const
|
|
2786
|
+
const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
2787
|
+
const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
2788
|
+
const configValue = merge(a, b, prop);
|
|
2651
2789
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2652
2790
|
});
|
|
2653
2791
|
|
|
2654
2792
|
return config;
|
|
2655
2793
|
}
|
|
2656
2794
|
|
|
2795
|
+
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
2796
|
+
|
|
2797
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
2798
|
+
if (policy !== 'content-only') {
|
|
2799
|
+
headers.set(formHeaders);
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2804
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
2805
|
+
headers.set(key, val);
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
/**
|
|
2811
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
2812
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
2813
|
+
*
|
|
2814
|
+
* @param {string} str The string to encode
|
|
2815
|
+
*
|
|
2816
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
2817
|
+
*/
|
|
2818
|
+
const encodeUTF8 = (str) =>
|
|
2819
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
2820
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
2821
|
+
);
|
|
2822
|
+
|
|
2657
2823
|
var resolveConfig = (config) => {
|
|
2658
2824
|
const newConfig = mergeConfig$1({}, config);
|
|
2659
2825
|
|
|
2660
|
-
|
|
2826
|
+
// Read only own properties to prevent prototype pollution gadgets
|
|
2827
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
2828
|
+
const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
|
|
2829
|
+
|
|
2830
|
+
const data = own('data');
|
|
2831
|
+
let withXSRFToken = own('withXSRFToken');
|
|
2832
|
+
const xsrfHeaderName = own('xsrfHeaderName');
|
|
2833
|
+
const xsrfCookieName = own('xsrfCookieName');
|
|
2834
|
+
let headers = own('headers');
|
|
2835
|
+
const auth = own('auth');
|
|
2836
|
+
const baseURL = own('baseURL');
|
|
2837
|
+
const allowAbsoluteUrls = own('allowAbsoluteUrls');
|
|
2838
|
+
const url = own('url');
|
|
2661
2839
|
|
|
2662
2840
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2663
2841
|
|
|
2664
2842
|
newConfig.url = buildURL(
|
|
2665
|
-
buildFullPath(
|
|
2843
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
2666
2844
|
config.params,
|
|
2667
2845
|
config.paramsSerializer
|
|
2668
2846
|
);
|
|
@@ -2672,11 +2850,7 @@ var resolveConfig = (config) => {
|
|
|
2672
2850
|
headers.set(
|
|
2673
2851
|
'Authorization',
|
|
2674
2852
|
'Basic ' +
|
|
2675
|
-
btoa(
|
|
2676
|
-
(auth.username || '') +
|
|
2677
|
-
':' +
|
|
2678
|
-
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
2679
|
-
)
|
|
2853
|
+
btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
|
|
2680
2854
|
);
|
|
2681
2855
|
}
|
|
2682
2856
|
|
|
@@ -2685,14 +2859,7 @@ var resolveConfig = (config) => {
|
|
|
2685
2859
|
headers.setContentType(undefined); // browser handles it
|
|
2686
2860
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2687
2861
|
// Node.js FormData (like form-data package)
|
|
2688
|
-
|
|
2689
|
-
// Only set safe headers to avoid overwriting security headers
|
|
2690
|
-
const allowedHeaders = ['content-type', 'content-length'];
|
|
2691
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2692
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
2693
|
-
headers.set(key, val);
|
|
2694
|
-
}
|
|
2695
|
-
});
|
|
2862
|
+
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
2696
2863
|
}
|
|
2697
2864
|
}
|
|
2698
2865
|
|
|
@@ -2701,10 +2868,17 @@ var resolveConfig = (config) => {
|
|
|
2701
2868
|
// Specifically not if we're in a web worker, or react-native.
|
|
2702
2869
|
|
|
2703
2870
|
if (platform.hasStandardBrowserEnv) {
|
|
2704
|
-
|
|
2871
|
+
if (utils$1.isFunction(withXSRFToken)) {
|
|
2872
|
+
withXSRFToken = withXSRFToken(newConfig);
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
// Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
|
|
2876
|
+
// and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
|
|
2877
|
+
// the XSRF token cross-origin.
|
|
2878
|
+
const shouldSendXSRF =
|
|
2879
|
+
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
2705
2880
|
|
|
2706
|
-
if (
|
|
2707
|
-
// Add xsrf header
|
|
2881
|
+
if (shouldSendXSRF) {
|
|
2708
2882
|
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
2709
2883
|
|
|
2710
2884
|
if (xsrfValue) {
|
|
@@ -2798,7 +2972,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2798
2972
|
// will return status as 0 even though it's a successful request
|
|
2799
2973
|
if (
|
|
2800
2974
|
request.status === 0 &&
|
|
2801
|
-
!(request.responseURL && request.responseURL.
|
|
2975
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
2802
2976
|
) {
|
|
2803
2977
|
return;
|
|
2804
2978
|
}
|
|
@@ -2815,6 +2989,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2815
2989
|
}
|
|
2816
2990
|
|
|
2817
2991
|
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
2992
|
+
done();
|
|
2818
2993
|
|
|
2819
2994
|
// Clean up request
|
|
2820
2995
|
request = null;
|
|
@@ -2830,6 +3005,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2830
3005
|
// attach the underlying event for consumers who want details
|
|
2831
3006
|
err.event = event || null;
|
|
2832
3007
|
reject(err);
|
|
3008
|
+
done();
|
|
2833
3009
|
request = null;
|
|
2834
3010
|
};
|
|
2835
3011
|
|
|
@@ -2850,6 +3026,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2850
3026
|
request
|
|
2851
3027
|
)
|
|
2852
3028
|
);
|
|
3029
|
+
done();
|
|
2853
3030
|
|
|
2854
3031
|
// Clean up request
|
|
2855
3032
|
request = null;
|
|
@@ -2899,6 +3076,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2899
3076
|
}
|
|
2900
3077
|
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2901
3078
|
request.abort();
|
|
3079
|
+
done();
|
|
2902
3080
|
request = null;
|
|
2903
3081
|
};
|
|
2904
3082
|
|
|
@@ -2912,7 +3090,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2912
3090
|
|
|
2913
3091
|
const protocol = parseProtocol(_config.url);
|
|
2914
3092
|
|
|
2915
|
-
if (protocol && platform.protocols.
|
|
3093
|
+
if (protocol && !platform.protocols.includes(protocol)) {
|
|
2916
3094
|
reject(
|
|
2917
3095
|
new AxiosError$1(
|
|
2918
3096
|
'Unsupported protocol ' + protocol + ':',
|
|
@@ -3069,16 +3247,112 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
3069
3247
|
);
|
|
3070
3248
|
};
|
|
3071
3249
|
|
|
3072
|
-
|
|
3250
|
+
/**
|
|
3251
|
+
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
3252
|
+
* - For base64: compute exact decoded size using length and padding;
|
|
3253
|
+
* handle %XX at the character-count level (no string allocation).
|
|
3254
|
+
* - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
|
|
3255
|
+
*
|
|
3256
|
+
* @param {string} url
|
|
3257
|
+
* @returns {number}
|
|
3258
|
+
*/
|
|
3259
|
+
function estimateDataURLDecodedBytes(url) {
|
|
3260
|
+
if (!url || typeof url !== 'string') return 0;
|
|
3261
|
+
if (!url.startsWith('data:')) return 0;
|
|
3262
|
+
|
|
3263
|
+
const comma = url.indexOf(',');
|
|
3264
|
+
if (comma < 0) return 0;
|
|
3265
|
+
|
|
3266
|
+
const meta = url.slice(5, comma);
|
|
3267
|
+
const body = url.slice(comma + 1);
|
|
3268
|
+
const isBase64 = /;base64/i.test(meta);
|
|
3269
|
+
|
|
3270
|
+
if (isBase64) {
|
|
3271
|
+
let effectiveLen = body.length;
|
|
3272
|
+
const len = body.length; // cache length
|
|
3273
|
+
|
|
3274
|
+
for (let i = 0; i < len; i++) {
|
|
3275
|
+
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
3276
|
+
const a = body.charCodeAt(i + 1);
|
|
3277
|
+
const b = body.charCodeAt(i + 2);
|
|
3278
|
+
const isHex =
|
|
3279
|
+
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
3280
|
+
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
3281
|
+
|
|
3282
|
+
if (isHex) {
|
|
3283
|
+
effectiveLen -= 2;
|
|
3284
|
+
i += 2;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3073
3288
|
|
|
3074
|
-
|
|
3289
|
+
let pad = 0;
|
|
3290
|
+
let idx = len - 1;
|
|
3291
|
+
|
|
3292
|
+
const tailIsPct3D = (j) =>
|
|
3293
|
+
j >= 2 &&
|
|
3294
|
+
body.charCodeAt(j - 2) === 37 && // '%'
|
|
3295
|
+
body.charCodeAt(j - 1) === 51 && // '3'
|
|
3296
|
+
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
|
|
3297
|
+
|
|
3298
|
+
if (idx >= 0) {
|
|
3299
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3300
|
+
pad++;
|
|
3301
|
+
idx--;
|
|
3302
|
+
} else if (tailIsPct3D(idx)) {
|
|
3303
|
+
pad++;
|
|
3304
|
+
idx -= 3;
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
if (pad === 1 && idx >= 0) {
|
|
3309
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3310
|
+
pad++;
|
|
3311
|
+
} else if (tailIsPct3D(idx)) {
|
|
3312
|
+
pad++;
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
const groups = Math.floor(effectiveLen / 4);
|
|
3317
|
+
const bytes = groups * 3 - (pad || 0);
|
|
3318
|
+
return bytes > 0 ? bytes : 0;
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
3322
|
+
return Buffer.byteLength(body, 'utf8');
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
3326
|
+
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
3327
|
+
// Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
|
|
3328
|
+
// but 3 UTF-8 bytes).
|
|
3329
|
+
let bytes = 0;
|
|
3330
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
3331
|
+
const c = body.charCodeAt(i);
|
|
3332
|
+
if (c < 0x80) {
|
|
3333
|
+
bytes += 1;
|
|
3334
|
+
} else if (c < 0x800) {
|
|
3335
|
+
bytes += 2;
|
|
3336
|
+
} else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
|
|
3337
|
+
const next = body.charCodeAt(i + 1);
|
|
3338
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
3339
|
+
bytes += 4;
|
|
3340
|
+
i++;
|
|
3341
|
+
} else {
|
|
3342
|
+
bytes += 3;
|
|
3343
|
+
}
|
|
3344
|
+
} else {
|
|
3345
|
+
bytes += 3;
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
return bytes;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
const VERSION$1 = "1.16.0";
|
|
3075
3352
|
|
|
3076
|
-
const
|
|
3077
|
-
Request,
|
|
3078
|
-
Response,
|
|
3079
|
-
}))(utils$1.global);
|
|
3353
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3080
3354
|
|
|
3081
|
-
const {
|
|
3355
|
+
const { isFunction } = utils$1;
|
|
3082
3356
|
|
|
3083
3357
|
const test = (fn, ...args) => {
|
|
3084
3358
|
try {
|
|
@@ -3089,11 +3363,17 @@ const test = (fn, ...args) => {
|
|
|
3089
3363
|
};
|
|
3090
3364
|
|
|
3091
3365
|
const factory = (env) => {
|
|
3366
|
+
const globalObject = utils$1.global ?? globalThis;
|
|
3367
|
+
const { ReadableStream, TextEncoder } = globalObject;
|
|
3368
|
+
|
|
3092
3369
|
env = utils$1.merge.call(
|
|
3093
3370
|
{
|
|
3094
3371
|
skipUndefined: true,
|
|
3095
3372
|
},
|
|
3096
|
-
|
|
3373
|
+
{
|
|
3374
|
+
Request: globalObject.Request,
|
|
3375
|
+
Response: globalObject.Response,
|
|
3376
|
+
},
|
|
3097
3377
|
env
|
|
3098
3378
|
);
|
|
3099
3379
|
|
|
@@ -3106,7 +3386,7 @@ const factory = (env) => {
|
|
|
3106
3386
|
return false;
|
|
3107
3387
|
}
|
|
3108
3388
|
|
|
3109
|
-
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream
|
|
3389
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
|
3110
3390
|
|
|
3111
3391
|
const encodeText =
|
|
3112
3392
|
isFetchSupported &&
|
|
@@ -3123,18 +3403,20 @@ const factory = (env) => {
|
|
|
3123
3403
|
test(() => {
|
|
3124
3404
|
let duplexAccessed = false;
|
|
3125
3405
|
|
|
3126
|
-
const
|
|
3127
|
-
|
|
3128
|
-
const hasContentType = new Request(platform.origin, {
|
|
3129
|
-
body,
|
|
3406
|
+
const request = new Request(platform.origin, {
|
|
3407
|
+
body: new ReadableStream(),
|
|
3130
3408
|
method: 'POST',
|
|
3131
3409
|
get duplex() {
|
|
3132
3410
|
duplexAccessed = true;
|
|
3133
3411
|
return 'half';
|
|
3134
3412
|
},
|
|
3135
|
-
})
|
|
3413
|
+
});
|
|
3136
3414
|
|
|
3137
|
-
|
|
3415
|
+
const hasContentType = request.headers.has('Content-Type');
|
|
3416
|
+
|
|
3417
|
+
if (request.body != null) {
|
|
3418
|
+
request.body.cancel();
|
|
3419
|
+
}
|
|
3138
3420
|
|
|
3139
3421
|
return duplexAccessed && !hasContentType;
|
|
3140
3422
|
});
|
|
@@ -3218,8 +3500,13 @@ const factory = (env) => {
|
|
|
3218
3500
|
headers,
|
|
3219
3501
|
withCredentials = 'same-origin',
|
|
3220
3502
|
fetchOptions,
|
|
3503
|
+
maxContentLength,
|
|
3504
|
+
maxBodyLength,
|
|
3221
3505
|
} = resolveConfig(config);
|
|
3222
3506
|
|
|
3507
|
+
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
3508
|
+
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
3509
|
+
|
|
3223
3510
|
let _fetch = envFetch || fetch;
|
|
3224
3511
|
|
|
3225
3512
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
@@ -3241,6 +3528,41 @@ const factory = (env) => {
|
|
|
3241
3528
|
let requestContentLength;
|
|
3242
3529
|
|
|
3243
3530
|
try {
|
|
3531
|
+
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
3532
|
+
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
3533
|
+
// "if (protocol === 'data:')" branch).
|
|
3534
|
+
if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
|
|
3535
|
+
const estimated = estimateDataURLDecodedBytes(url);
|
|
3536
|
+
if (estimated > maxContentLength) {
|
|
3537
|
+
throw new AxiosError$1(
|
|
3538
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3539
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3540
|
+
config,
|
|
3541
|
+
request
|
|
3542
|
+
);
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
// Enforce maxBodyLength against the outbound request body before dispatch.
|
|
3547
|
+
// Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
|
|
3548
|
+
// maxBodyLength limit'). Skip when the body length cannot be determined
|
|
3549
|
+
// (e.g. a live ReadableStream supplied by the caller).
|
|
3550
|
+
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
3551
|
+
const outboundLength = await resolveBodyLength(headers, data);
|
|
3552
|
+
if (
|
|
3553
|
+
typeof outboundLength === 'number' &&
|
|
3554
|
+
isFinite(outboundLength) &&
|
|
3555
|
+
outboundLength > maxBodyLength
|
|
3556
|
+
) {
|
|
3557
|
+
throw new AxiosError$1(
|
|
3558
|
+
'Request body larger than maxBodyLength limit',
|
|
3559
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3560
|
+
config,
|
|
3561
|
+
request
|
|
3562
|
+
);
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3244
3566
|
if (
|
|
3245
3567
|
onUploadProgress &&
|
|
3246
3568
|
supportsRequestStream &&
|
|
@@ -3278,6 +3600,22 @@ const factory = (env) => {
|
|
|
3278
3600
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3279
3601
|
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3280
3602
|
|
|
3603
|
+
// If data is FormData and Content-Type is multipart/form-data without boundary,
|
|
3604
|
+
// delete it so fetch can set it correctly with the boundary
|
|
3605
|
+
if (utils$1.isFormData(data)) {
|
|
3606
|
+
const contentType = headers.getContentType();
|
|
3607
|
+
if (
|
|
3608
|
+
contentType &&
|
|
3609
|
+
/^multipart\/form-data/i.test(contentType) &&
|
|
3610
|
+
!/boundary=/i.test(contentType)
|
|
3611
|
+
) {
|
|
3612
|
+
headers.delete('content-type');
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
|
|
3616
|
+
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
3617
|
+
headers.set('User-Agent', 'axios/' + VERSION$1, false);
|
|
3618
|
+
|
|
3281
3619
|
const resolvedOptions = {
|
|
3282
3620
|
...fetchOptions,
|
|
3283
3621
|
signal: composedSignal,
|
|
@@ -3294,10 +3632,28 @@ const factory = (env) => {
|
|
|
3294
3632
|
? _fetch(request, fetchOptions)
|
|
3295
3633
|
: _fetch(url, resolvedOptions));
|
|
3296
3634
|
|
|
3635
|
+
// Cheap pre-check: if the server honestly declares a content-length that
|
|
3636
|
+
// already exceeds the cap, reject before we start streaming.
|
|
3637
|
+
if (hasMaxContentLength) {
|
|
3638
|
+
const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3639
|
+
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
3640
|
+
throw new AxiosError$1(
|
|
3641
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3642
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3643
|
+
config,
|
|
3644
|
+
request
|
|
3645
|
+
);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3297
3649
|
const isStreamResponse =
|
|
3298
3650
|
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3299
3651
|
|
|
3300
|
-
if (
|
|
3652
|
+
if (
|
|
3653
|
+
supportsResponseStream &&
|
|
3654
|
+
response.body &&
|
|
3655
|
+
(onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
|
|
3656
|
+
) {
|
|
3301
3657
|
const options = {};
|
|
3302
3658
|
|
|
3303
3659
|
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
@@ -3314,8 +3670,24 @@ const factory = (env) => {
|
|
|
3314
3670
|
)) ||
|
|
3315
3671
|
[];
|
|
3316
3672
|
|
|
3673
|
+
let bytesRead = 0;
|
|
3674
|
+
const onChunkProgress = (loadedBytes) => {
|
|
3675
|
+
if (hasMaxContentLength) {
|
|
3676
|
+
bytesRead = loadedBytes;
|
|
3677
|
+
if (bytesRead > maxContentLength) {
|
|
3678
|
+
throw new AxiosError$1(
|
|
3679
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3680
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3681
|
+
config,
|
|
3682
|
+
request
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
onProgress && onProgress(loadedBytes);
|
|
3687
|
+
};
|
|
3688
|
+
|
|
3317
3689
|
response = new Response(
|
|
3318
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE,
|
|
3690
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
|
|
3319
3691
|
flush && flush();
|
|
3320
3692
|
unsubscribe && unsubscribe();
|
|
3321
3693
|
}),
|
|
@@ -3330,6 +3702,33 @@ const factory = (env) => {
|
|
|
3330
3702
|
config
|
|
3331
3703
|
);
|
|
3332
3704
|
|
|
3705
|
+
// Fallback enforcement for environments without ReadableStream support
|
|
3706
|
+
// (legacy runtimes). Detect materialized size from typed output; skip
|
|
3707
|
+
// streams/Response passthrough since the user will read those themselves.
|
|
3708
|
+
if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
|
|
3709
|
+
let materializedSize;
|
|
3710
|
+
if (responseData != null) {
|
|
3711
|
+
if (typeof responseData.byteLength === 'number') {
|
|
3712
|
+
materializedSize = responseData.byteLength;
|
|
3713
|
+
} else if (typeof responseData.size === 'number') {
|
|
3714
|
+
materializedSize = responseData.size;
|
|
3715
|
+
} else if (typeof responseData === 'string') {
|
|
3716
|
+
materializedSize =
|
|
3717
|
+
typeof TextEncoder === 'function'
|
|
3718
|
+
? new TextEncoder().encode(responseData).byteLength
|
|
3719
|
+
: responseData.length;
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
|
|
3723
|
+
throw new AxiosError$1(
|
|
3724
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3725
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3726
|
+
config,
|
|
3727
|
+
request
|
|
3728
|
+
);
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
|
|
3333
3732
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3334
3733
|
|
|
3335
3734
|
return await new Promise((resolve, reject) => {
|
|
@@ -3345,6 +3744,17 @@ const factory = (env) => {
|
|
|
3345
3744
|
} catch (err) {
|
|
3346
3745
|
unsubscribe && unsubscribe();
|
|
3347
3746
|
|
|
3747
|
+
// Safari can surface fetch aborts as a DOMException-like object whose
|
|
3748
|
+
// branded getters throw. Prefer our composed signal reason before reading
|
|
3749
|
+
// the caught error, preserving timeout vs cancellation semantics.
|
|
3750
|
+
if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1) {
|
|
3751
|
+
const canceledError = composedSignal.reason;
|
|
3752
|
+
canceledError.config = config;
|
|
3753
|
+
request && (canceledError.request = request);
|
|
3754
|
+
err !== canceledError && (canceledError.cause = err);
|
|
3755
|
+
throw canceledError;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3348
3758
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3349
3759
|
throw Object.assign(
|
|
3350
3760
|
new AxiosError$1(
|
|
@@ -3413,11 +3823,13 @@ const knownAdapters = {
|
|
|
3413
3823
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3414
3824
|
if (fn) {
|
|
3415
3825
|
try {
|
|
3416
|
-
Object.
|
|
3826
|
+
// Null-proto descriptors so a polluted Object.prototype.get cannot turn
|
|
3827
|
+
// these data descriptors into accessor descriptors on the way in.
|
|
3828
|
+
Object.defineProperty(fn, 'name', { __proto__: null, value });
|
|
3417
3829
|
} catch (e) {
|
|
3418
3830
|
// eslint-disable-next-line no-empty
|
|
3419
3831
|
}
|
|
3420
|
-
Object.defineProperty(fn, 'adapterName', { value });
|
|
3832
|
+
Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
|
|
3421
3833
|
}
|
|
3422
3834
|
});
|
|
3423
3835
|
|
|
@@ -3559,8 +3971,15 @@ function dispatchRequest(config) {
|
|
|
3559
3971
|
function onAdapterResolution(response) {
|
|
3560
3972
|
throwIfCancellationRequested(config);
|
|
3561
3973
|
|
|
3562
|
-
//
|
|
3563
|
-
|
|
3974
|
+
// Expose the current response on config so that transformResponse can
|
|
3975
|
+
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
3976
|
+
// We clean it up afterwards to avoid polluting the config object.
|
|
3977
|
+
config.response = response;
|
|
3978
|
+
try {
|
|
3979
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
3980
|
+
} finally {
|
|
3981
|
+
delete config.response;
|
|
3982
|
+
}
|
|
3564
3983
|
|
|
3565
3984
|
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3566
3985
|
|
|
@@ -3572,11 +3991,16 @@ function dispatchRequest(config) {
|
|
|
3572
3991
|
|
|
3573
3992
|
// Transform response data
|
|
3574
3993
|
if (reason && reason.response) {
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3994
|
+
config.response = reason.response;
|
|
3995
|
+
try {
|
|
3996
|
+
reason.response.data = transformData.call(
|
|
3997
|
+
config,
|
|
3998
|
+
config.transformResponse,
|
|
3999
|
+
reason.response
|
|
4000
|
+
);
|
|
4001
|
+
} finally {
|
|
4002
|
+
delete config.response;
|
|
4003
|
+
}
|
|
3580
4004
|
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
3581
4005
|
}
|
|
3582
4006
|
}
|
|
@@ -3586,8 +4010,6 @@ function dispatchRequest(config) {
|
|
|
3586
4010
|
);
|
|
3587
4011
|
}
|
|
3588
4012
|
|
|
3589
|
-
const VERSION$1 = "1.15.0";
|
|
3590
|
-
|
|
3591
4013
|
const validators$1 = {};
|
|
3592
4014
|
|
|
3593
4015
|
// eslint-disable-next-line func-names
|
|
@@ -3671,7 +4093,9 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3671
4093
|
let i = keys.length;
|
|
3672
4094
|
while (i-- > 0) {
|
|
3673
4095
|
const opt = keys[i];
|
|
3674
|
-
|
|
4096
|
+
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
4097
|
+
// a non-function validator and cause a TypeError.
|
|
4098
|
+
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
3675
4099
|
if (validator) {
|
|
3676
4100
|
const value = options[opt];
|
|
3677
4101
|
const result = value === undefined || validator(value, opt, options);
|
|
@@ -3830,7 +4254,7 @@ let Axios$1 = class Axios {
|
|
|
3830
4254
|
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3831
4255
|
|
|
3832
4256
|
headers &&
|
|
3833
|
-
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
4257
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
|
|
3834
4258
|
delete headers[method];
|
|
3835
4259
|
});
|
|
3836
4260
|
|
|
@@ -3933,7 +4357,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
3933
4357
|
};
|
|
3934
4358
|
});
|
|
3935
4359
|
|
|
3936
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4360
|
+
utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
3937
4361
|
function generateHTTPMethod(isForm) {
|
|
3938
4362
|
return function httpMethod(url, data, config) {
|
|
3939
4363
|
return this.request(
|
|
@@ -3953,7 +4377,11 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
|
|
|
3953
4377
|
|
|
3954
4378
|
Axios$1.prototype[method] = generateHTTPMethod();
|
|
3955
4379
|
|
|
3956
|
-
|
|
4380
|
+
// QUERY is a safe/idempotent read method; multipart form bodies don't fit
|
|
4381
|
+
// its semantics, so no queryForm shorthand is generated.
|
|
4382
|
+
if (method !== 'query') {
|
|
4383
|
+
Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4384
|
+
}
|
|
3957
4385
|
});
|
|
3958
4386
|
|
|
3959
4387
|
/**
|
|
@@ -4287,7 +4715,8 @@ const {
|
|
|
4287
4715
|
formToJSON,
|
|
4288
4716
|
getAdapter,
|
|
4289
4717
|
mergeConfig,
|
|
4718
|
+
create,
|
|
4290
4719
|
} = axios;
|
|
4291
4720
|
|
|
4292
|
-
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, axios as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
|
|
4721
|
+
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, create, axios as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
|
|
4293
4722
|
//# sourceMappingURL=axios.js.map
|