net/http: GET request with http.NoBody fails on js/wasm #36339
Closed
Labels
Comments
This is fixed now: 7bfac4c#diff-e85f2dbad3447c4267e815cc9d014e69. |
@agnivade I see the logging was improved, but that diff does look to make any changes that would fix request with |
Oh my apologies, I somehow thought that the issue was about logging. Reopening. |
Change https://golang.org/cl/237758 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: