Skip to content

Commit 530c1cf

Browse files
committed
refactor: use :scheme for request URL's scheme if it's HTTP/2
1 parent 8ec0b0b commit 530c1cf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/request.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@ export const newRequest = (
190190
}
191191
const url = new URL(
192192
`${
193-
incoming instanceof Http2ServerRequest ||
194-
(incoming.socket && (incoming.socket as TLSSocket).encrypted)
195-
? 'https'
196-
: 'http'
193+
incoming instanceof Http2ServerRequest
194+
? incoming.scheme
195+
: incoming.socket && (incoming.socket as TLSSocket).encrypted
196+
? 'https'
197+
: 'http'
197198
}://${host}${incomingUrl}`
198199
)
199200

0 commit comments

Comments
 (0)