axios 0.35.0 → 0.36.0
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/README.md +4 -0
- package/dist/axios.js +19 -7
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/esm/axios.js +19 -7
- 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/lib/adapters/http.js +139 -28
- package/lib/core/InterceptorManager.js +2 -2
- package/lib/env/data.js +1 -1
- package/lib/helpers/combineURLs.js +15 -3
- package/lib/helpers/proxyFromEnv.js +152 -0
- package/lib/helpers/shouldBypassProxy.js +2 -2
- package/package.json +17 -18
package/lib/adapters/http.js
CHANGED
|
@@ -4,7 +4,7 @@ var utils = require('./../utils');
|
|
|
4
4
|
var settle = require('./../core/settle');
|
|
5
5
|
var buildFullPath = require('../core/buildFullPath');
|
|
6
6
|
var buildURL = require('./../helpers/buildURL');
|
|
7
|
-
var getProxyForUrl = require('
|
|
7
|
+
var getProxyForUrl = require('../helpers/proxyFromEnv').getProxyForUrl;
|
|
8
8
|
var http = require('http');
|
|
9
9
|
var https = require('https');
|
|
10
10
|
var httpFollow = require('follow-redirects/http');
|
|
@@ -29,7 +29,52 @@ var supportedProtocols = platform.protocols.map(function(protocol) {
|
|
|
29
29
|
return protocol + ':';
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
// Options that follow-redirects reads but axios does not always set.
|
|
33
|
+
// follow-redirects copies the request options into a plain object, so any of
|
|
34
|
+
// these left unset would be read from Object.prototype. hostname and port are
|
|
35
|
+
// only unset for socketPath requests. Audited against follow-redirects 1.16.3.
|
|
36
|
+
var REDIRECT_OPTION_KEYS = [
|
|
37
|
+
'host',
|
|
38
|
+
'hostname',
|
|
39
|
+
'port',
|
|
40
|
+
'pathname',
|
|
41
|
+
'search',
|
|
42
|
+
'hash',
|
|
43
|
+
'query',
|
|
44
|
+
'slashes',
|
|
45
|
+
'followRedirects',
|
|
46
|
+
'trackRedirects',
|
|
47
|
+
'sensitiveHeaders'
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
// follow-redirects reads these when a response arrives rather than when the
|
|
51
|
+
// request starts, so they are pinned even when nothing is inherited yet.
|
|
52
|
+
var RESPONSE_OPTION_KEYS = ['followRedirects', 'trackRedirects'];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Give the options follow-redirects reads an own value whenever one would
|
|
56
|
+
* otherwise be inherited. dispatchBeforeRedirect also resets host, auth and
|
|
57
|
+
* query on each redirect hop. Other keys that are not inherited are left
|
|
58
|
+
* unset, so the options object keeps its usual shape.
|
|
59
|
+
*
|
|
60
|
+
* @param {Object} options
|
|
61
|
+
*/
|
|
62
|
+
function setRedirectDefaults(options) {
|
|
63
|
+
REDIRECT_OPTION_KEYS.forEach(function setDefault(key) {
|
|
64
|
+
if (utils.hasOwnProperty(options, key)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (key in options || RESPONSE_OPTION_KEYS.indexOf(key) !== -1) {
|
|
68
|
+
options[key] = undefined;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
32
73
|
function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
74
|
+
// follow-redirects copies auth and query from a WHATWG URL, which has
|
|
75
|
+
// neither, so both would otherwise be read from Object.prototype.
|
|
76
|
+
options.auth = undefined;
|
|
77
|
+
options.query = undefined;
|
|
33
78
|
var sameOrigin = false;
|
|
34
79
|
try {
|
|
35
80
|
sameOrigin = new url.URL(requestDetails.url).origin === new url.URL(options.href).origin;
|
|
@@ -42,7 +87,6 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
|
42
87
|
delete options.headers[header];
|
|
43
88
|
}
|
|
44
89
|
});
|
|
45
|
-
delete options.auth;
|
|
46
90
|
}
|
|
47
91
|
if (options.beforeRedirects.proxy) {
|
|
48
92
|
options.beforeRedirects.proxy(options);
|
|
@@ -53,6 +97,14 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
|
53
97
|
if (options.beforeRedirects.config) {
|
|
54
98
|
options.beforeRedirects.config(options);
|
|
55
99
|
}
|
|
100
|
+
// follow-redirects deletes a truthy host after this hook returns, which
|
|
101
|
+
// would let the next hop read host from Object.prototype. Fold it into
|
|
102
|
+
// hostname the same way follow-redirects does, but keep an own value.
|
|
103
|
+
if (options.host && !options.hostname) {
|
|
104
|
+
options.hostname = options.host;
|
|
105
|
+
}
|
|
106
|
+
options.host = undefined;
|
|
107
|
+
setRedirectDefaults(options);
|
|
56
108
|
}
|
|
57
109
|
|
|
58
110
|
function setDirectAgent(options, httpAgent, httpsAgent) {
|
|
@@ -70,17 +122,56 @@ function removeProxyAuthorization(headers) {
|
|
|
70
122
|
});
|
|
71
123
|
}
|
|
72
124
|
|
|
125
|
+
// Windows named pipes and Linux abstract sockets (leading NUL byte) are not
|
|
126
|
+
// filesystem paths, so they are compared and connected to as given.
|
|
127
|
+
function isNonFileSocketPath(socketPath) {
|
|
128
|
+
return /^\\\\[.?]\\pipe\\/i.test(socketPath) || socketPath.charAt(0) === '\0';
|
|
129
|
+
}
|
|
130
|
+
|
|
73
131
|
function normalizeSocketPath(socketPath) {
|
|
74
|
-
if (
|
|
132
|
+
if (isNonFileSocketPath(socketPath)) {
|
|
75
133
|
return socketPath;
|
|
76
134
|
}
|
|
77
135
|
|
|
78
136
|
return path.resolve(socketPath);
|
|
79
137
|
}
|
|
80
138
|
|
|
81
|
-
|
|
82
|
-
|
|
139
|
+
// The longest socket path every supported platform accepts: sun_path is 104
|
|
140
|
+
// bytes on macOS and the BSDs and 108 on Linux, including the trailing NUL.
|
|
141
|
+
var MAX_SOCKET_PATH_BYTES = 103;
|
|
142
|
+
|
|
143
|
+
// The path to connect to when an allowlist is in use. `..` is collapsed
|
|
144
|
+
// lexically, as the allowlist check does, so a symlinked directory cannot send
|
|
145
|
+
// the connection somewhere the check did not allow.
|
|
146
|
+
//
|
|
147
|
+
// The absolute path is used whenever it fits, so the target does not depend on
|
|
148
|
+
// the working directory when the connection opens (an Agent can open it later,
|
|
149
|
+
// after a process.chdir()). Only when the absolute path is too long is the
|
|
150
|
+
// shorter path relative to the working directory used. Either way the result
|
|
151
|
+
// is never longer than the absolute path, because some Node versions silently
|
|
152
|
+
// truncate a socket path that is too long and would connect to a prefix of it.
|
|
153
|
+
function getConnectSocketPath(socketPath) {
|
|
154
|
+
if (isNonFileSocketPath(socketPath)) {
|
|
155
|
+
return socketPath;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var resolved = path.resolve(socketPath);
|
|
83
159
|
|
|
160
|
+
if (
|
|
161
|
+
path.isAbsolute(socketPath) ||
|
|
162
|
+
Buffer.byteLength(resolved) <= MAX_SOCKET_PATH_BYTES
|
|
163
|
+
) {
|
|
164
|
+
return resolved;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var relative = path.relative(process.cwd(), resolved) || '.';
|
|
168
|
+
|
|
169
|
+
return Buffer.byteLength(relative) < Buffer.byteLength(resolved) ?
|
|
170
|
+
relative :
|
|
171
|
+
resolved;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function getAllowedSocketPaths(allowedSocketPaths) {
|
|
84
175
|
if (
|
|
85
176
|
allowedSocketPaths === null ||
|
|
86
177
|
typeof allowedSocketPaths === 'undefined'
|
|
@@ -105,9 +196,12 @@ function getAllowedSocketPaths(config) {
|
|
|
105
196
|
return false;
|
|
106
197
|
}
|
|
107
198
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
199
|
+
// Validates socketPath against allowedSocketPaths and returns the path to
|
|
200
|
+
// connect to, an AxiosError, or null when there is no socketPath. Each config
|
|
201
|
+
// value is read once by the caller, so the path that is connected is the one
|
|
202
|
+
// that was checked. It returns plain values rather than an object so no result
|
|
203
|
+
// field can be inherited from a polluted Object.prototype.
|
|
204
|
+
function resolveSocketPath(socketPath, allowedSocketPaths, config) {
|
|
111
205
|
if (!socketPath) {
|
|
112
206
|
return null;
|
|
113
207
|
}
|
|
@@ -120,7 +214,7 @@ function checkSocketPath(config) {
|
|
|
120
214
|
);
|
|
121
215
|
}
|
|
122
216
|
|
|
123
|
-
|
|
217
|
+
allowedSocketPaths = getAllowedSocketPaths(allowedSocketPaths);
|
|
124
218
|
|
|
125
219
|
if (allowedSocketPaths === false) {
|
|
126
220
|
return new AxiosError(
|
|
@@ -130,24 +224,29 @@ function checkSocketPath(config) {
|
|
|
130
224
|
);
|
|
131
225
|
}
|
|
132
226
|
|
|
133
|
-
if (allowedSocketPaths) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
function isAllowed(allowedSocketPath) {
|
|
137
|
-
return normalizeSocketPath(allowedSocketPath) === normalizedSocketPath;
|
|
138
|
-
}
|
|
139
|
-
);
|
|
227
|
+
if (!allowedSocketPaths) {
|
|
228
|
+
return socketPath;
|
|
229
|
+
}
|
|
140
230
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
231
|
+
// The checked value is derived from the path that will be connected, so the
|
|
232
|
+
// two cannot disagree.
|
|
233
|
+
var connectSocketPath = getConnectSocketPath(socketPath);
|
|
234
|
+
var normalizedSocketPath = normalizeSocketPath(connectSocketPath);
|
|
235
|
+
var allowed = allowedSocketPaths.some(
|
|
236
|
+
function isAllowed(allowedSocketPath) {
|
|
237
|
+
return normalizeSocketPath(allowedSocketPath) === normalizedSocketPath;
|
|
147
238
|
}
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
if (!allowed) {
|
|
242
|
+
return new AxiosError(
|
|
243
|
+
'config.socketPath is not allowed by config.allowedSocketPaths',
|
|
244
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
245
|
+
config
|
|
246
|
+
);
|
|
148
247
|
}
|
|
149
248
|
|
|
150
|
-
return
|
|
249
|
+
return connectSocketPath;
|
|
151
250
|
}
|
|
152
251
|
|
|
153
252
|
/**
|
|
@@ -510,14 +609,25 @@ module.exports = function httpAdapter(config) {
|
|
|
510
609
|
beforeRedirects: Object.create(null)
|
|
511
610
|
};
|
|
512
611
|
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
|
|
612
|
+
var socketTarget = resolveSocketPath(
|
|
613
|
+
config.socketPath,
|
|
614
|
+
config.allowedSocketPaths,
|
|
615
|
+
config
|
|
616
|
+
);
|
|
617
|
+
if (socketTarget instanceof AxiosError) {
|
|
618
|
+
return reject(socketTarget);
|
|
516
619
|
}
|
|
517
620
|
|
|
518
|
-
if (
|
|
519
|
-
options.socketPath =
|
|
621
|
+
if (socketTarget) {
|
|
622
|
+
options.socketPath = socketTarget;
|
|
520
623
|
} else {
|
|
624
|
+
// Node 14 and older copy the request options into a plain object and
|
|
625
|
+
// read socketPath from it, so an inherited value would turn this into a
|
|
626
|
+
// socket request. Only pinned when one is inherited, to keep the usual
|
|
627
|
+
// shape of the options object.
|
|
628
|
+
if ('socketPath' in options) {
|
|
629
|
+
options.socketPath = undefined;
|
|
630
|
+
}
|
|
521
631
|
options.hostname = parsed.hostname;
|
|
522
632
|
options.port = parsed.port;
|
|
523
633
|
setProxy(
|
|
@@ -548,6 +658,7 @@ module.exports = function httpAdapter(config) {
|
|
|
548
658
|
if (config.beforeRedirect) {
|
|
549
659
|
options.beforeRedirects.config = config.beforeRedirect;
|
|
550
660
|
}
|
|
661
|
+
setRedirectDefaults(options);
|
|
551
662
|
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
552
663
|
}
|
|
553
664
|
|
|
@@ -18,8 +18,8 @@ InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
|
|
18
18
|
this.handlers.push({
|
|
19
19
|
fulfilled: fulfilled,
|
|
20
20
|
rejected: rejected,
|
|
21
|
-
synchronous: options ? options.synchronous : false,
|
|
22
|
-
runWhen: options ? options.runWhen : null
|
|
21
|
+
synchronous: options && utils.hasOwnProperty(options, 'synchronous') ? options.synchronous : false,
|
|
22
|
+
runWhen: options && utils.hasOwnProperty(options, 'runWhen') ? options.runWhen : null
|
|
23
23
|
});
|
|
24
24
|
return this.handlers.length - 1;
|
|
25
25
|
};
|
package/lib/env/data.js
CHANGED
|
@@ -8,7 +8,19 @@
|
|
|
8
8
|
* @returns {string} The combined URL
|
|
9
9
|
*/
|
|
10
10
|
module.exports = function combineURLs(baseURL, relativeURL) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (!relativeURL) {
|
|
12
|
+
return baseURL;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var base = baseURL.replace(/\/?\/$/, '');
|
|
16
|
+
|
|
17
|
+
if (/^\/*$/.test(base)) {
|
|
18
|
+
// A base made only of slashes points at the root of the current origin.
|
|
19
|
+
// Drop leading slashes, backslashes, tabs and newlines from the relative
|
|
20
|
+
// URL as well: URL parsers ignore tabs and newlines and treat '\' as '/',
|
|
21
|
+
// so leaving them would turn the result into a protocol-relative URL.
|
|
22
|
+
return '/' + relativeURL.replace(/^[\/\\\t\n\r]+/, '');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return base + '/' + relativeURL.replace(/^\/+/, '');
|
|
14
26
|
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Resolves the proxy for a URL from the standard proxy environment variables.
|
|
4
|
+
// Adapted from proxy-from-env 1.1.0 (https://github.com/Rob--W/proxy-from-env).
|
|
5
|
+
// A variable that is not set on process.env itself is ignored when
|
|
6
|
+
// Object.prototype has a property of the same name, so a polluted prototype
|
|
7
|
+
// cannot choose the proxy or skip it. The port of a parsed URL object is also
|
|
8
|
+
// read as a decimal number, which matches every port url.parse produces.
|
|
9
|
+
//
|
|
10
|
+
// proxy-from-env is distributed under the MIT License:
|
|
11
|
+
//
|
|
12
|
+
// Copyright (C) 2016-2018 Rob Wu <rob@robwu.nl>
|
|
13
|
+
//
|
|
14
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
15
|
+
// this software and associated documentation files (the "Software"), to deal in
|
|
16
|
+
// the Software without restriction, including without limitation the rights to
|
|
17
|
+
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
18
|
+
// of the Software, and to permit persons to whom the Software is furnished to do
|
|
19
|
+
// so, subject to the following conditions:
|
|
20
|
+
//
|
|
21
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
// copies or substantial portions of the Software.
|
|
23
|
+
//
|
|
24
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
26
|
+
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
27
|
+
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
28
|
+
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
29
|
+
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
|
|
31
|
+
var parseUrl = require('url').parse;
|
|
32
|
+
var utils = require('./../utils');
|
|
33
|
+
|
|
34
|
+
var DEFAULT_PORTS = {
|
|
35
|
+
ftp: 21,
|
|
36
|
+
gopher: 70,
|
|
37
|
+
http: 80,
|
|
38
|
+
https: 443,
|
|
39
|
+
ws: 80,
|
|
40
|
+
wss: 443
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Read one environment variable without trusting Object.prototype.
|
|
45
|
+
*
|
|
46
|
+
* A name that is not set on process.env itself is ignored when Object.prototype
|
|
47
|
+
* has a property of the same name. Any other name is read as usual, so an env
|
|
48
|
+
* object that a test runner replaces or wraps keeps working.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} name The exact name of the environment variable.
|
|
51
|
+
* @returns {string|undefined} The value, or undefined when it must not be used.
|
|
52
|
+
*/
|
|
53
|
+
function readEnv(name) {
|
|
54
|
+
var env = process.env;
|
|
55
|
+
|
|
56
|
+
if (utils.hasOwnProperty(env, name) || !(name in Object.prototype)) {
|
|
57
|
+
return env[name];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get the value of an environment variable, preferring the lower-case name.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} key The name of the environment variable.
|
|
67
|
+
* @returns {string} The value, or an empty string when it is not set.
|
|
68
|
+
*/
|
|
69
|
+
function getEnv(key) {
|
|
70
|
+
return readEnv(key.toLowerCase()) || readEnv(key.toUpperCase()) || '';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function shouldProxy(hostname, port) {
|
|
74
|
+
var noProxy = (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase();
|
|
75
|
+
|
|
76
|
+
if (!noProxy) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (noProxy === '*') {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return noProxy.split(/[,\s]/).every(function testEntry(entry) {
|
|
85
|
+
if (!entry) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var parsedEntry = entry.match(/^(.+):(\d+)$/);
|
|
90
|
+
var entryHostname = parsedEntry ? parsedEntry[1] : entry;
|
|
91
|
+
var entryPort = parsedEntry ? parseInt(parsedEntry[2], 10) : 0;
|
|
92
|
+
|
|
93
|
+
if (entryPort && entryPort !== port) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!/^[.*]/.test(entryHostname)) {
|
|
98
|
+
return hostname !== entryHostname;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (entryHostname.charAt(0) === '*') {
|
|
102
|
+
entryHostname = entryHostname.slice(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return !utils.endsWith(hostname, entryHostname);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get the proxy URL that should handle a request to the given URL.
|
|
111
|
+
*
|
|
112
|
+
* @param {string|Object} location The request URL, or the result of url.parse.
|
|
113
|
+
* @returns {string} The proxy URL, or an empty string when no proxy applies.
|
|
114
|
+
*/
|
|
115
|
+
function getProxyForUrl(location) {
|
|
116
|
+
var parsedUrl = typeof location === 'string' ? parseUrl(location) : location || {};
|
|
117
|
+
var proto = parsedUrl.protocol;
|
|
118
|
+
var hostname = parsedUrl.host;
|
|
119
|
+
var port = parsedUrl.port;
|
|
120
|
+
|
|
121
|
+
if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {
|
|
122
|
+
return '';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
proto = proto.split(':', 1)[0];
|
|
126
|
+
// Strip the port this way rather than using parsedUrl.hostname so the
|
|
127
|
+
// brackets around IPv6 addresses are kept.
|
|
128
|
+
hostname = hostname.replace(/:\d*$/, '');
|
|
129
|
+
port = parseInt(port, 10) || DEFAULT_PORTS[proto] || 0;
|
|
130
|
+
|
|
131
|
+
if (!shouldProxy(hostname, port)) {
|
|
132
|
+
return '';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
var proxy =
|
|
136
|
+
getEnv('npm_config_' + proto + '_proxy') ||
|
|
137
|
+
getEnv(proto + '_proxy') ||
|
|
138
|
+
getEnv('npm_config_proxy') ||
|
|
139
|
+
getEnv('all_proxy');
|
|
140
|
+
|
|
141
|
+
if (proxy && proxy.indexOf('://') === -1) {
|
|
142
|
+
// No scheme in the proxy value: default to the request URL's scheme.
|
|
143
|
+
proxy = proto + '://' + proxy;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return proxy;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = {
|
|
150
|
+
getProxyForUrl: getProxyForUrl,
|
|
151
|
+
getEnv: getEnv
|
|
152
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var URL = require('url').URL;
|
|
4
4
|
var domainToASCII = require('url').domainToASCII;
|
|
5
|
+
var getEnv = require('./proxyFromEnv').getEnv;
|
|
5
6
|
|
|
6
7
|
var DEFAULT_PORTS = {
|
|
7
8
|
http: 80,
|
|
@@ -355,8 +356,7 @@ module.exports = function shouldBypassProxy(location) {
|
|
|
355
356
|
return false;
|
|
356
357
|
}
|
|
357
358
|
|
|
358
|
-
var noProxy = (
|
|
359
|
-
process.env.no_proxy || process.env.NO_PROXY || '').toLowerCase();
|
|
359
|
+
var noProxy = (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase();
|
|
360
360
|
|
|
361
361
|
if (!noProxy) {
|
|
362
362
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axios",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Promise based HTTP client for the browser and node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -36,47 +36,47 @@
|
|
|
36
36
|
"@rollup/plugin-json": "^4.1.0",
|
|
37
37
|
"@rollup/plugin-multi-entry": "^4.0.0",
|
|
38
38
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
39
|
-
"abortcontroller-polyfill": "^1.7.
|
|
40
|
-
"body-parser": "^1.20.
|
|
39
|
+
"abortcontroller-polyfill": "^1.7.8",
|
|
40
|
+
"body-parser": "^1.20.9",
|
|
41
41
|
"coveralls": "^3.1.1",
|
|
42
42
|
"cross-env": "^7.0.3",
|
|
43
43
|
"dtslint": "4.2.1",
|
|
44
44
|
"es6-promise": "^4.2.8",
|
|
45
|
-
"express": "^4.
|
|
46
|
-
"formidable": "
|
|
47
|
-
"grunt": "
|
|
45
|
+
"express": "^4.22.3",
|
|
46
|
+
"formidable": "2.1.2",
|
|
47
|
+
"grunt": "~1.5.3",
|
|
48
48
|
"grunt-banner": "^0.6.0",
|
|
49
|
-
"grunt-cli": "^1.
|
|
49
|
+
"grunt-cli": "^1.5.0",
|
|
50
50
|
"grunt-contrib-clean": "^2.0.0",
|
|
51
51
|
"grunt-contrib-watch": "^1.1.0",
|
|
52
|
-
"grunt-eslint": "^24.
|
|
52
|
+
"grunt-eslint": "^24.3.0",
|
|
53
53
|
"grunt-karma": "^4.0.2",
|
|
54
54
|
"grunt-mocha-test": "^0.13.3",
|
|
55
55
|
"grunt-shell": "^3.0.1",
|
|
56
56
|
"grunt-webpack": "^5.0.0",
|
|
57
57
|
"istanbul-instrumenter-loader": "^3.0.1",
|
|
58
58
|
"jasmine-core": "^2.4.1",
|
|
59
|
-
"karma": "^6.
|
|
60
|
-
"karma-chrome-launcher": "^3.
|
|
59
|
+
"karma": "^6.4.4",
|
|
60
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
61
61
|
"karma-firefox-launcher": "^2.1.2",
|
|
62
62
|
"karma-jasmine": "^1.1.1",
|
|
63
63
|
"karma-jasmine-ajax": "^0.1.13",
|
|
64
64
|
"karma-safari-launcher": "^1.0.0",
|
|
65
65
|
"karma-sauce-launcher": "^4.3.6",
|
|
66
66
|
"karma-sinon": "^1.0.5",
|
|
67
|
-
"karma-sourcemap-loader": "^0.
|
|
67
|
+
"karma-sourcemap-loader": "^0.4.0",
|
|
68
68
|
"karma-webpack": "^4.0.2",
|
|
69
69
|
"load-grunt-tasks": "^5.1.0",
|
|
70
|
-
"minimist": "^1.2.
|
|
70
|
+
"minimist": "^1.2.8",
|
|
71
71
|
"mocha": "^8.2.1",
|
|
72
72
|
"multer": "^1.4.4",
|
|
73
|
-
"rollup": "^2.
|
|
73
|
+
"rollup": "^2.80.0",
|
|
74
74
|
"rollup-plugin-terser": "^7.0.2",
|
|
75
75
|
"sinon": "^4.5.0",
|
|
76
76
|
"terser-webpack-plugin": "^4.2.3",
|
|
77
|
-
"typescript": "^4.
|
|
77
|
+
"typescript": "^4.9.5",
|
|
78
78
|
"url-search-params": "^0.10.0",
|
|
79
|
-
"webpack": "^4.
|
|
79
|
+
"webpack": "^4.47.0",
|
|
80
80
|
"webpack-dev-server": "^3.11.0"
|
|
81
81
|
},
|
|
82
82
|
"browser": {
|
|
@@ -87,9 +87,8 @@
|
|
|
87
87
|
"unpkg": "dist/axios.min.js",
|
|
88
88
|
"typings": "./index.d.ts",
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"follow-redirects": "^1.
|
|
91
|
-
"form-data": "^4.0.
|
|
92
|
-
"proxy-from-env": "^1.1.0"
|
|
90
|
+
"follow-redirects": "^1.16.2",
|
|
91
|
+
"form-data": "^4.0.6"
|
|
93
92
|
},
|
|
94
93
|
"bundlesize": [
|
|
95
94
|
{
|