Skip to content

fix: allow native DialOptions fields on Wasm - #597

Open
SilverBirchh wants to merge 1 commit into
coder:masterfrom
SilverBirchh:wasm-dial-options
Open

SilverBirchh wants to merge 1 commit into
coder:masterfrom
SilverBirchh:wasm-dial-options

Conversation

@SilverBirchh

Copy link
Copy Markdown

On Wasm, DialOptions only had Subprotocols, so code that sets HTTPClient or HTTPHeader compiled natively but not for Wasm. Libraries that support both, like mautrix-go, had to split each Dial call behind build tags.

This adds the native fields to the Wasm DialOptions, as AcceptOptions already does. Dial ignores them, since the browser does the handshake and can't use them.

TestWasmDialIgnoresNativeOptions dials with them set, and the Wasm tests pass in headless Chrome.

Updates #373

🤖 This PR was created with the help of Claude Code.

DialOptions on Wasm had only Subprotocols, so code that sets HTTPClient
or HTTPHeader for native builds did not compile for Wasm, and libraries
supporting both had to split each Dial call behind build tags. The Wasm
DialOptions now has the native fields and Dial ignores them, since the
browser performs the handshake and cannot use them.

This branch has not been deployed

No deployments
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.

1 participant