affiliations
This commit is contained in:
1 parent
4f3f9c9aad
commit
0b5b3dd3ee
177 files changed
+9660
-8531
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ The modules under `adapters/` are modules that handle dispatching a request and
|
||||
## Example
|
||||
|
||||
```js
|
||||
var settle = require('./../core/settle');
|
||||
var settle = require('../core/settle');
|
||||
|
||||
module.exports = function myAdapter(config) {
|
||||
// At this point:
|
||||
|
||||
+13
-10
@@ -1,7 +1,7 @@
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import utils from '../utils.js';
|
||||
import settle from '../core/settle.js';
|
||||
import buildFullPath from '../core/buildFullPath.js';
|
||||
import buildURL from './../helpers/buildURL.js';
|
||||
import buildURL from '../helpers/buildURL.js';
|
||||
import proxyFromEnv from 'proxy-from-env';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
@@ -193,12 +193,16 @@ function setProxy(options, configProxy, location) {
|
||||
|
||||
if (proxy.auth) {
|
||||
// Support proxy auth object form
|
||||
if (proxy.auth.username || proxy.auth.password) {
|
||||
const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
|
||||
|
||||
if (validProxyAuth) {
|
||||
proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
|
||||
} else if (typeof proxy.auth === 'object') {
|
||||
throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, { proxy });
|
||||
}
|
||||
const base64 = Buffer
|
||||
.from(proxy.auth, 'utf8')
|
||||
.toString('base64');
|
||||
|
||||
const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
|
||||
|
||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||
}
|
||||
|
||||
@@ -264,7 +268,8 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr
|
||||
|
||||
const http2Transport = {
|
||||
request(options, cb) {
|
||||
const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
|
||||
const authority = options.protocol + '//' + options.hostname + ':' + (options.port ||(options.protocol === 'https:' ? 443 : 80));
|
||||
|
||||
|
||||
const {http2Options, headers} = options;
|
||||
|
||||
@@ -812,8 +817,6 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
// Handle errors
|
||||
req.on('error', function handleRequestError(err) {
|
||||
// @todo remove
|
||||
// if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
|
||||
reject(AxiosError.from(err, null, config, req));
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import utils from '../utils.js';
|
||||
import settle from '../core/settle.js';
|
||||
import transitionalDefaults from '../defaults/transitional.js';
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import CanceledError from '../cancel/CanceledError.js';
|
||||
|
||||
Reference in new issue
Block a user