mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
fix(http): use default export for http2 module to support stubs; (#7196)
This commit is contained in:
committed by
GitHub
parent
1ef8e7218b
commit
0588880ac7
@@ -1,4 +1,3 @@
|
|||||||
import { connect, constants } from 'http2';
|
|
||||||
import utils from './../utils.js';
|
import utils from './../utils.js';
|
||||||
import settle from './../core/settle.js';
|
import settle from './../core/settle.js';
|
||||||
import buildFullPath from '../core/buildFullPath.js';
|
import buildFullPath from '../core/buildFullPath.js';
|
||||||
@@ -6,6 +5,7 @@ import buildURL from './../helpers/buildURL.js';
|
|||||||
import proxyFromEnv from 'proxy-from-env';
|
import proxyFromEnv from 'proxy-from-env';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
|
import http2 from 'http2';
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
import followRedirects from 'follow-redirects';
|
import followRedirects from 'follow-redirects';
|
||||||
import zlib from 'zlib';
|
import zlib from 'zlib';
|
||||||
@@ -36,13 +36,6 @@ const brotliOptions = {
|
|||||||
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
|
||||||
HTTP2_HEADER_SCHEME,
|
|
||||||
HTTP2_HEADER_METHOD,
|
|
||||||
HTTP2_HEADER_PATH,
|
|
||||||
HTTP2_HEADER_STATUS
|
|
||||||
} = constants;
|
|
||||||
|
|
||||||
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
||||||
|
|
||||||
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
||||||
@@ -85,7 +78,7 @@ class Http2Sessions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const session = connect(authority, options);
|
const session = http2.connect(authority, options);
|
||||||
|
|
||||||
let removed;
|
let removed;
|
||||||
|
|
||||||
@@ -276,6 +269,13 @@ const http2Transport = {
|
|||||||
|
|
||||||
const session = http2Sessions.getSession(authority, http2Options);
|
const session = http2Sessions.getSession(authority, http2Options);
|
||||||
|
|
||||||
|
const {
|
||||||
|
HTTP2_HEADER_SCHEME,
|
||||||
|
HTTP2_HEADER_METHOD,
|
||||||
|
HTTP2_HEADER_PATH,
|
||||||
|
HTTP2_HEADER_STATUS
|
||||||
|
} = http2.constants;
|
||||||
|
|
||||||
const http2Headers = {
|
const http2Headers = {
|
||||||
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
||||||
[HTTP2_HEADER_METHOD]: options.method,
|
[HTTP2_HEADER_METHOD]: options.method,
|
||||||
|
|||||||
Reference in New Issue
Block a user