Skip to content

Commit b280168

Browse files
committed
fix override h1.keepAlive, h1.family by h1NoCache
1 parent 4fe3148 commit b280168

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/fetch.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { h1NoCache, noCache, createUrl, AbortController, AbortError, FetchError
33
import { serialize as serializeCookie, parse as parseCookie } from 'cookie';
44
import log from '../logging.js';
55

6-
// TODO: review, use keepAliveNoCache, review keepAlive: true (default in many options).
6+
const h1_options = {
7+
alpnProtocols: [ALPN_HTTP1_1]
8+
}
79

810
const fetchKeepAlive = noCache({
911
h1: {
@@ -15,14 +17,16 @@ const fetchKeepAlive = noCache({
1517
rejectUnauthorized: false // By default skip auth check for all.
1618
}).fetch;
1719

18-
const fetchH1KeepAlive = h1NoCache({
20+
const fetchH1KeepAlive = noCache({
21+
...h1_options,
1922
h1: {
2023
keepAlive: true
2124
},
2225
rejectUnauthorized: false // By default skip auth check for all.
2326
}).fetch;
2427

25-
const fetchIPv4H1KeepAlive = h1NoCache({
28+
const fetchIPv4H1KeepAlive = noCache({
29+
...h1_options,
2630
h1: {
2731
keepAlive: true,
2832
family: 4
@@ -38,7 +42,8 @@ const fetchAuthorized = noCache({
3842

3943
const fetchH1Authorized = h1NoCache().fetch; // `rejectUnauthorized: true` - by `fetch` default.
4044

41-
const fetchIPv4H1Authorized = h1NoCache({
45+
const fetchIPv4H1Authorized = noCache({
46+
...h1_options,
4247
h1: {
4348
keepAlive: true,
4449
family: 4
@@ -56,9 +61,10 @@ const fetchH1 = h1NoCache({
5661
rejectUnauthorized: false // By default skip auth check for all.
5762
}).fetch;
5863

59-
const fetchIPv4H1 = h1NoCache({
64+
const fetchIPv4H1 = noCache({
65+
...h1_options,
6066
h1: {
61-
keepAlive: false, // Default from `h1NoCache`.
67+
keepAlive: false,
6268
family: 4
6369
},
6470
rejectUnauthorized: false // By default skip auth check for all.

0 commit comments

Comments
 (0)