Skip to content

Commit 8606263

Browse files
committed
fix(client): renamed EVersion.AUTO to EVersion.ALPN
1 parent af009ad commit 8606263

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"cSpell.words": [
4+
"ALPN"
5+
]
36
}

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- fix(client): Use HTTP/1.1 when ALPN is not supported by remote server.
77
- fix(client): Preventing from memory leak when `h2` is selected by ALPN.
88
- fix(client): Allow string-type content-length.
9+
- fix(client): Renamed `EVersion.AUTO` to `EVersion.ALPN`.
910
- build(deps): removed all runtime dependencies.
1011

1112
## v1.0.5

src/lib/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class HttpClient implements C.IClient {
159159
/**
160160
* When version is set to `0`, detect the protocol supported by server automatically.
161161
*/
162-
if (opts.version === C.EVersion.AUTO) {
162+
if (opts.version === C.EVersion.ALPN) {
163163

164164
for (const k of ['h1s', 'h2s'] as const) {
165165

@@ -190,7 +190,7 @@ class HttpClient implements C.IClient {
190190
switch (opts.version) {
191191
case C.EVersion.HTTP_2:
192192
return this._wrapResponse(this._clients.h2.request(opts));
193-
case C.EVersion.AUTO:
193+
case C.EVersion.ALPN:
194194
case C.EVersion.HTTP_1_1:
195195
return this._wrapResponse(this._clients.h1.request(opts));
196196
default:

src/lib/Common/Basic.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,9 @@ export type CreateInputOptions<T, TRequired extends keyof T, TOptional extends k
5353
export enum EVersion {
5454
HTTP_1_1 = 1.1,
5555
HTTP_2 = 2,
56-
AUTO = 0
56+
/**
57+
* @deprecated Use `EVersion.ALPN` instead.
58+
*/
59+
AUTO = 0,
60+
ALPN = 0,
5761
}

0 commit comments

Comments
 (0)