Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix baseUrl without // mangling request URL on Node.js with HTTP/2 #1220

Conversation

timostamm
Copy link
Member

@timostamm timostamm commented Sep 9, 2024

Fixes #958

@@ -280,7 +280,7 @@ function h2Request(
options: Omit<http2.ClientSessionRequestOptions, "signal">,
onStream: (stream: http2.ClientHttp2Stream) => void,
): void {
const requestUrl = new URL(url, sm.authority);
const requestUrl = new URL(url);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL constructor parses https:localhost:8443, but not when the base argument is given.

The result here used to be https://localhost:8443/localhost:8443/connectrpc.eliza.v1.ElizaService/Introduce, and is now the expected https://localhost:8443/connectrpc.eliza.v1.ElizaService/Introduce.

IIRC, the authority was only given as a base to potentially support relative URLs, but I don't actually see us supporting them in a meaningful way with this HTTP client.

@timostamm timostamm merged commit 6d375c1 into main Sep 9, 2024
48 checks passed
@timostamm timostamm deleted the tstamm/Fix-baseUrl-without-slash-mangling-request-URL-on-Node.js-with-HTTP2 branch September 9, 2024 15:14
@timostamm timostamm mentioned this pull request Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

baseUrl without // leads to HTTP 404 response
2 participants