|
1 | | -import { connect, constants } from 'http2'; |
2 | 1 | import utils from './../utils.js'; |
3 | 2 | import settle from './../core/settle.js'; |
4 | 3 | import buildFullPath from '../core/buildFullPath.js'; |
5 | 4 | import buildURL from './../helpers/buildURL.js'; |
6 | 5 | import proxyFromEnv from 'proxy-from-env'; |
7 | 6 | import http from 'http'; |
8 | 7 | import https from 'https'; |
| 8 | +import http2 from 'http2'; |
9 | 9 | import util from 'util'; |
10 | 10 | import followRedirects from 'follow-redirects'; |
11 | 11 | import zlib from 'zlib'; |
@@ -36,13 +36,6 @@ const brotliOptions = { |
36 | 36 | finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH |
37 | 37 | } |
38 | 38 |
|
39 | | -const { |
40 | | - HTTP2_HEADER_SCHEME, |
41 | | - HTTP2_HEADER_METHOD, |
42 | | - HTTP2_HEADER_PATH, |
43 | | - HTTP2_HEADER_STATUS |
44 | | -} = constants; |
45 | | - |
46 | 39 | const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress); |
47 | 40 |
|
48 | 41 | const {http: httpFollow, https: httpsFollow} = followRedirects; |
@@ -85,7 +78,7 @@ class Http2Sessions { |
85 | 78 | } |
86 | 79 | } |
87 | 80 |
|
88 | | - const session = connect(authority, options); |
| 81 | + const session = http2.connect(authority, options); |
89 | 82 |
|
90 | 83 | let removed; |
91 | 84 |
|
@@ -276,6 +269,13 @@ const http2Transport = { |
276 | 269 |
|
277 | 270 | const session = http2Sessions.getSession(authority, http2Options); |
278 | 271 |
|
| 272 | + const { |
| 273 | + HTTP2_HEADER_SCHEME, |
| 274 | + HTTP2_HEADER_METHOD, |
| 275 | + HTTP2_HEADER_PATH, |
| 276 | + HTTP2_HEADER_STATUS |
| 277 | + } = http2.constants; |
| 278 | + |
279 | 279 | const http2Headers = { |
280 | 280 | [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''), |
281 | 281 | [HTTP2_HEADER_METHOD]: options.method, |
|
0 commit comments