axios 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +12 -0
- package/dist/axios.js +4 -4
- 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 +4 -4
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +4 -4
- 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 +17 -9
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/http.js +12 -5
- package/lib/core/AxiosHeaders.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/toFormData.js +1 -1
- package/package.json +1 -1
package/lib/adapters/http.js
CHANGED
@@ -7,6 +7,7 @@ import buildURL from './../helpers/buildURL.js';
|
|
7
7
|
import {getProxyForUrl} from 'proxy-from-env';
|
8
8
|
import http from 'http';
|
9
9
|
import https from 'https';
|
10
|
+
import util from 'util';
|
10
11
|
import followRedirects from 'follow-redirects';
|
11
12
|
import zlib from 'zlib';
|
12
13
|
import {VERSION} from '../env/data.js';
|
@@ -117,7 +118,8 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(pr
|
|
117
118
|
|
118
119
|
/*eslint consistent-return:0*/
|
119
120
|
export default isHttpAdapterSupported && function httpAdapter(config) {
|
120
|
-
|
121
|
+
/*eslint no-async-promise-executor:0*/
|
122
|
+
return new Promise(async function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
121
123
|
let data = config.data;
|
122
124
|
const responseType = config.responseType;
|
123
125
|
const responseEncoding = config.responseEncoding;
|
@@ -208,7 +210,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
208
210
|
convertedData = convertedData.toString(responseEncoding);
|
209
211
|
|
210
212
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
211
|
-
|
213
|
+
convertedData = utils.stripBOM(convertedData);
|
212
214
|
}
|
213
215
|
} else if (responseType === 'stream') {
|
214
216
|
convertedData = stream.Readable.from(convertedData);
|
@@ -258,9 +260,14 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
258
260
|
// support for https://www.npmjs.com/package/form-data api
|
259
261
|
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
260
262
|
headers.set(data.getHeaders());
|
261
|
-
|
262
|
-
|
263
|
-
|
263
|
+
|
264
|
+
if (!headers.hasContentLength()) {
|
265
|
+
try {
|
266
|
+
const knownLength = await util.promisify(data.getLength).call(data);
|
267
|
+
headers.setContentLength(knownLength);
|
268
|
+
/*eslint no-empty:0*/
|
269
|
+
} catch (e) {
|
270
|
+
}
|
264
271
|
}
|
265
272
|
} else if (utils.isBlob(data)) {
|
266
273
|
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
package/lib/core/AxiosHeaders.js
CHANGED
@@ -141,7 +141,7 @@ class AxiosHeaders {
|
|
141
141
|
if (header) {
|
142
142
|
const key = utils.findKey(this, header);
|
143
143
|
|
144
|
-
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
144
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
145
145
|
}
|
146
146
|
|
147
147
|
return false;
|
package/lib/env/data.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "1.3.
|
1
|
+
export const VERSION = "1.3.1";
|
@@ -152,7 +152,7 @@ function toFormData(obj, formData, options) {
|
|
152
152
|
value = JSON.stringify(value);
|
153
153
|
} else if (
|
154
154
|
(utils.isArray(value) && isFlatArray(value)) ||
|
155
|
-
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
|
155
|
+
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
156
156
|
)) {
|
157
157
|
// eslint-disable-next-line no-param-reassign
|
158
158
|
key = removeBrackets(key);
|