net/http: roundtrip_js.go unusable in Node.js tests #31559
Labels
arch-wasm
WebAssembly issues
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release? Yes.
What operating system and processor architecture are you using (
go env
)?go env
What did you do?
I wrote a test that requires a network request to
localhost
using thenet/http
library, compiled it to WASM and attempted to run it using Node.js. In order to get it to work in a Node.js environment, I add a shim forfetch
by requiring theisomorphic-fetch
NPM package.What did you expect to see?
I expected the request to complete without an error.
What did you see instead?
Digging into
roundtrip_js.go
, I found this check:Where
useFakeNetwork
is defined as:This logic means that any test making a network request that gets compiled to WASM is re-routed to a fake in-memory network. Non-WASM tests do not exhibit this behavior.
Is there any chance the core devs would consider making this behavior optional? Perhaps via an environment variable?
The text was updated successfully, but these errors were encountered: