Skip to content

Commit 0588880

Browse files
authored
fix(http): use default export for http2 module to support stubs; (#7196)
1 parent 1ef8e72 commit 0588880

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

lib/adapters/http.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { connect, constants } from 'http2';
21
import utils from './../utils.js';
32
import settle from './../core/settle.js';
43
import buildFullPath from '../core/buildFullPath.js';
54
import buildURL from './../helpers/buildURL.js';
65
import proxyFromEnv from 'proxy-from-env';
76
import http from 'http';
87
import https from 'https';
8+
import http2 from 'http2';
99
import util from 'util';
1010
import followRedirects from 'follow-redirects';
1111
import zlib from 'zlib';
@@ -36,13 +36,6 @@ const brotliOptions = {
3636
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
3737
}
3838

39-
const {
40-
HTTP2_HEADER_SCHEME,
41-
HTTP2_HEADER_METHOD,
42-
HTTP2_HEADER_PATH,
43-
HTTP2_HEADER_STATUS
44-
} = constants;
45-
4639
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
4740

4841
const {http: httpFollow, https: httpsFollow} = followRedirects;
@@ -85,7 +78,7 @@ class Http2Sessions {
8578
}
8679
}
8780

88-
const session = connect(authority, options);
81+
const session = http2.connect(authority, options);
8982

9083
let removed;
9184

@@ -276,6 +269,13 @@ const http2Transport = {
276269

277270
const session = http2Sessions.getSession(authority, http2Options);
278271

272+
const {
273+
HTTP2_HEADER_SCHEME,
274+
HTTP2_HEADER_METHOD,
275+
HTTP2_HEADER_PATH,
276+
HTTP2_HEADER_STATUS
277+
} = http2.constants;
278+
279279
const http2Headers = {
280280
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
281281
[HTTP2_HEADER_METHOD]: options.method,

0 commit comments

Comments
 (0)