Skip to content

WebTransport ignores query parameters in URL #5496

Description

@weary-adventurer

Describe the bug
The final WebTransport URL doesn't include the query parameters from the original URL.

To Reproduce

engine.io-client 6.6.4

Client

// Connects to: https://localhost:1234/engine.io/?x=y&EIO=4&transport=polling&t=zsyh7czl 
eio("https://localhost:1234/?x=y", {transports: ["polling"]});

// Connects to: wss://localhost:1234/engine.io/?x=y&EIO=4&transport=websocket
eio("https://localhost:1234/?x=y", {transports: ["websocket"]});

// Connects to: https://localhost:1234/engine.io/
eio("https://localhost:1234/?x=y", {transports: ["webtransport"]});

Expected behavior
The WebTransport transport should preserve the query parameters in the same way other transports do.

Additional context

WebTransport currently uses createUri to construct the URL:

this._transport = new WebTransport(
this.createUri("https"),
this.opts.transportOptions[this.name],
);

It doesn't include the original query parameters:

protected createUri(schema: string, query: Record<string, unknown> = {}) {
return (
schema +
"://" +
this._hostname() +
this._port() +
this.opts.path +
this._query(query)
);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions