Skip to content

Commit b35cf5e

Browse files
Derive HTTP/2 session origin from request URL
1 parent 85e9b63 commit b35cf5e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/js-sdk/src/envd/http2.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ class NodeHttp2Fetch {
2121
fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
2222
const request = new Request(input, init)
2323
const url = new URL(request.url)
24-
const origin = `${url.protocol}//${url.host}`
2524

26-
return this.fetchWithSession(origin, request, url, 0)
25+
return this.fetchWithSession(request, url, 0)
2726
}
2827

2928
private async fetchWithSession(
30-
origin: string,
3129
request: Request,
3230
url: URL,
3331
redirectCount: number
3432
): Promise<Response> {
33+
const origin = `${url.protocol}//${url.host}`
3534
const requestBody =
3635
request.method === 'GET' || request.method === 'HEAD'
3736
? undefined
@@ -167,7 +166,6 @@ class NodeHttp2Fetch {
167166

168167
resolve(
169168
this.fetchWithSession(
170-
`${redirectUrl.protocol}//${redirectUrl.host}`,
171169
redirectRequest,
172170
redirectUrl,
173171
redirectCount + 1

0 commit comments

Comments
 (0)