net/http: GET request with http.NoBody fails on js/wasm #36339
Labels
arch-wasm
WebAssembly issues
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
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
OutputWhat did you do?
I executed code that makes a HTTP GET request using
net/http
facilities and it failed with the following error:I then added
js.Global().Get("console").Call("log", args[0])
on line 160 of roundtrip_js.go and observed:I then changed the body of the request created from
http.NoBody
tonil
and observed a successful request being made:req, err := http.NewRequest(http.MethodGet, URL, http.NoBody)
req, err := http.NewRequest(http.MethodGet, URL, nil)
P.S. In roundtrip_js.go and the similar stdlib JavaScript platform code, if existing error reporting code such as:
is replaced with:
the output changes from:
To
which is substantially more helpful and perhaps warrants another issue. 😸
What did you expect to see?
Success. I expect nil and http.NoBody to function identically with respect to client `*http.Request``'s.
What did you see instead?
Failure, GET requests under
GOARCH=wasm GOOS=js
fail when the request body ishttp.NoBody
rather thannil
.The text was updated successfully, but these errors were encountered: