mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +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 settle from './../core/settle.js';
|
||||
import buildFullPath from '../core/buildFullPath.js';
|
||||
@@ -6,6 +5,7 @@ import buildURL from './../helpers/buildURL.js';
|
||||
import proxyFromEnv from 'proxy-from-env';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import http2 from 'http2';
|
||||
import util from 'util';
|
||||
import followRedirects from 'follow-redirects';
|
||||
import zlib from 'zlib';
|
||||
@@ -36,13 +36,6 @@ const brotliOptions = {
|
||||
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 {http: httpFollow, https: httpsFollow} = followRedirects;
|
||||
@@ -85,7 +78,7 @@ class Http2Sessions {
|
||||
}
|
||||
}
|
||||
|
||||
const session = connect(authority, options);
|
||||
const session = http2.connect(authority, options);
|
||||
|
||||
let removed;
|
||||
|
||||
@@ -276,6 +269,13 @@ const http2Transport = {
|
||||
|
||||
const session = http2Sessions.getSession(authority, http2Options);
|
||||
|
||||
const {
|
||||
HTTP2_HEADER_SCHEME,
|
||||
HTTP2_HEADER_METHOD,
|
||||
HTTP2_HEADER_PATH,
|
||||
HTTP2_HEADER_STATUS
|
||||
} = http2.constants;
|
||||
|
||||
const http2Headers = {
|
||||
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
||||
[HTTP2_HEADER_METHOD]: options.method,
|
||||
|
||||
Reference in New Issue
Block a user