axios 1.2.0 → 1.2.2
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.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +54 -0
- package/README.md +2 -3
- package/dist/axios.js +102 -5
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +108 -7
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +118 -15
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +111 -15
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +23 -12
- package/index.d.ts +17 -6
- package/index.js +6 -2
- package/lib/.DS_Store +0 -0
- package/lib/adapters/http.js +23 -8
- package/lib/adapters/xhr.js +2 -2
- package/lib/axios.js +6 -0
- package/lib/core/dispatchRequest.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/HttpStatusCode.js +71 -0
- package/lib/helpers/speedometer.js +1 -1
- package/lib/platform/browser/index.js +20 -0
- package/lib/utils.js +5 -1
- package/package.json +54 -6
- package/bin/ssl_hotfix.js +0 -22
- package/gulpfile.js +0 -88
- package/karma.conf.cjs +0 -250
- package/rollup.config.js +0 -117
- package/tsconfig.json +0 -9
- package/tslint.json +0 -11
package/dist/browser/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.2.
|
1
|
+
// Axios v1.2.2 Copyright (c) 2022 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
function bind(fn, thisArg) {
|
@@ -282,7 +282,11 @@ function findKey(obj, key) {
|
|
282
282
|
return null;
|
283
283
|
}
|
284
284
|
|
285
|
-
const _global =
|
285
|
+
const _global = (() => {
|
286
|
+
/*eslint no-undef:0*/
|
287
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
288
|
+
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
289
|
+
})();
|
286
290
|
|
287
291
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
288
292
|
|
@@ -1219,6 +1223,25 @@ const isStandardBrowserEnv = (() => {
|
|
1219
1223
|
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
1220
1224
|
})();
|
1221
1225
|
|
1226
|
+
/**
|
1227
|
+
* Determine if we're running in a standard browser webWorker environment
|
1228
|
+
*
|
1229
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
1230
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
1231
|
+
* filtered out due to its judgment standard
|
1232
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
1233
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
1234
|
+
*/
|
1235
|
+
const isStandardBrowserWebWorkerEnv = (() => {
|
1236
|
+
return (
|
1237
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
1238
|
+
// eslint-disable-next-line no-undef
|
1239
|
+
self instanceof WorkerGlobalScope &&
|
1240
|
+
typeof self.importScripts === 'function'
|
1241
|
+
);
|
1242
|
+
})();
|
1243
|
+
|
1244
|
+
|
1222
1245
|
var platform = {
|
1223
1246
|
isBrowser: true,
|
1224
1247
|
classes: {
|
@@ -1227,6 +1250,7 @@ var platform = {
|
|
1227
1250
|
Blob
|
1228
1251
|
},
|
1229
1252
|
isStandardBrowserEnv,
|
1253
|
+
isStandardBrowserWebWorkerEnv,
|
1230
1254
|
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
1231
1255
|
};
|
1232
1256
|
|
@@ -2091,7 +2115,7 @@ function speedometer(samplesCount, min) {
|
|
2091
2115
|
|
2092
2116
|
const passed = startedAt && now - startedAt;
|
2093
2117
|
|
2094
|
-
return
|
2118
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
2095
2119
|
};
|
2096
2120
|
}
|
2097
2121
|
|
@@ -2142,7 +2166,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2142
2166
|
}
|
2143
2167
|
}
|
2144
2168
|
|
2145
|
-
if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
|
2169
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
|
2146
2170
|
requestHeaders.setContentType(false); // Let the browser set it
|
2147
2171
|
}
|
2148
2172
|
|
@@ -2170,7 +2194,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2170
2194
|
const responseHeaders = AxiosHeaders$1.from(
|
2171
2195
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
2172
2196
|
);
|
2173
|
-
const responseData = !responseType || responseType === 'text' ||
|
2197
|
+
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
2174
2198
|
request.responseText : request.response;
|
2175
2199
|
const response = {
|
2176
2200
|
data: responseData,
|
@@ -2397,7 +2421,7 @@ function throwIfCancellationRequested(config) {
|
|
2397
2421
|
}
|
2398
2422
|
|
2399
2423
|
if (config.signal && config.signal.aborted) {
|
2400
|
-
throw new CanceledError();
|
2424
|
+
throw new CanceledError(null, config);
|
2401
2425
|
}
|
2402
2426
|
}
|
2403
2427
|
|
@@ -2558,7 +2582,7 @@ function mergeConfig(config1, config2) {
|
|
2558
2582
|
return config;
|
2559
2583
|
}
|
2560
2584
|
|
2561
|
-
const VERSION = "1.2.
|
2585
|
+
const VERSION = "1.2.2";
|
2562
2586
|
|
2563
2587
|
const validators$1 = {};
|
2564
2588
|
|
@@ -2990,6 +3014,78 @@ function isAxiosError(payload) {
|
|
2990
3014
|
return utils.isObject(payload) && (payload.isAxiosError === true);
|
2991
3015
|
}
|
2992
3016
|
|
3017
|
+
const HttpStatusCode = {
|
3018
|
+
Continue: 100,
|
3019
|
+
SwitchingProtocols: 101,
|
3020
|
+
Processing: 102,
|
3021
|
+
EarlyHints: 103,
|
3022
|
+
Ok: 200,
|
3023
|
+
Created: 201,
|
3024
|
+
Accepted: 202,
|
3025
|
+
NonAuthoritativeInformation: 203,
|
3026
|
+
NoContent: 204,
|
3027
|
+
ResetContent: 205,
|
3028
|
+
PartialContent: 206,
|
3029
|
+
MultiStatus: 207,
|
3030
|
+
AlreadyReported: 208,
|
3031
|
+
ImUsed: 226,
|
3032
|
+
MultipleChoices: 300,
|
3033
|
+
MovedPermanently: 301,
|
3034
|
+
Found: 302,
|
3035
|
+
SeeOther: 303,
|
3036
|
+
NotModified: 304,
|
3037
|
+
UseProxy: 305,
|
3038
|
+
Unused: 306,
|
3039
|
+
TemporaryRedirect: 307,
|
3040
|
+
PermanentRedirect: 308,
|
3041
|
+
BadRequest: 400,
|
3042
|
+
Unauthorized: 401,
|
3043
|
+
PaymentRequired: 402,
|
3044
|
+
Forbidden: 403,
|
3045
|
+
NotFound: 404,
|
3046
|
+
MethodNotAllowed: 405,
|
3047
|
+
NotAcceptable: 406,
|
3048
|
+
ProxyAuthenticationRequired: 407,
|
3049
|
+
RequestTimeout: 408,
|
3050
|
+
Conflict: 409,
|
3051
|
+
Gone: 410,
|
3052
|
+
LengthRequired: 411,
|
3053
|
+
PreconditionFailed: 412,
|
3054
|
+
PayloadTooLarge: 413,
|
3055
|
+
UriTooLong: 414,
|
3056
|
+
UnsupportedMediaType: 415,
|
3057
|
+
RangeNotSatisfiable: 416,
|
3058
|
+
ExpectationFailed: 417,
|
3059
|
+
ImATeapot: 418,
|
3060
|
+
MisdirectedRequest: 421,
|
3061
|
+
UnprocessableEntity: 422,
|
3062
|
+
Locked: 423,
|
3063
|
+
FailedDependency: 424,
|
3064
|
+
TooEarly: 425,
|
3065
|
+
UpgradeRequired: 426,
|
3066
|
+
PreconditionRequired: 428,
|
3067
|
+
TooManyRequests: 429,
|
3068
|
+
RequestHeaderFieldsTooLarge: 431,
|
3069
|
+
UnavailableForLegalReasons: 451,
|
3070
|
+
InternalServerError: 500,
|
3071
|
+
NotImplemented: 501,
|
3072
|
+
BadGateway: 502,
|
3073
|
+
ServiceUnavailable: 503,
|
3074
|
+
GatewayTimeout: 504,
|
3075
|
+
HttpVersionNotSupported: 505,
|
3076
|
+
VariantAlsoNegotiates: 506,
|
3077
|
+
InsufficientStorage: 507,
|
3078
|
+
LoopDetected: 508,
|
3079
|
+
NotExtended: 510,
|
3080
|
+
NetworkAuthenticationRequired: 511,
|
3081
|
+
};
|
3082
|
+
|
3083
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
3084
|
+
HttpStatusCode[value] = key;
|
3085
|
+
});
|
3086
|
+
|
3087
|
+
var HttpStatusCode$1 = HttpStatusCode;
|
3088
|
+
|
2993
3089
|
/**
|
2994
3090
|
* Create an instance of Axios
|
2995
3091
|
*
|
@@ -3044,10 +3140,15 @@ axios.spread = spread;
|
|
3044
3140
|
// Expose isAxiosError
|
3045
3141
|
axios.isAxiosError = isAxiosError;
|
3046
3142
|
|
3143
|
+
// Expose mergeConfig
|
3144
|
+
axios.mergeConfig = mergeConfig;
|
3145
|
+
|
3047
3146
|
axios.AxiosHeaders = AxiosHeaders$1;
|
3048
3147
|
|
3049
3148
|
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
3050
3149
|
|
3150
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
3151
|
+
|
3051
3152
|
axios.default = axios;
|
3052
3153
|
|
3053
3154
|
module.exports = axios;
|