net/http: Fetch API-based Transport is accidentally disabled too widely #60808
Labels
arch-wasm
WebAssembly issues
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
OS-JS
Milestone
During the Go 1.21 dev cycle, we updated from Node 14 to 18, which seems to provide the Fetch API, at least enough to cause it to be turned on during tests and not use the fake network. Since the HTTP server part is still implemented only as a fake network, that caused all tests/examples that start an HTTP server and send requests to it to fail. See #57613 for details.
Unfortunately the current implementation of
jsFetchDisabled
:go/src/net/http/roundtrip_js.go
Lines 47 to 51 in 9fc8436
Intersects poorly with wasm_exec.js that sets a "process" global whenever it's not already there:
go/misc/wasm/wasm_exec.js
Lines 62 to 73 in 9fc8436
So it ends up inadvertently disabling Fetch API not only during testing as intended, but also in browsers that use an unmodified copy of wasm_exec.js.
CC @golang/js, @golang/wasm.
The text was updated successfully, but these errors were encountered: