mirror of https://github.com/golang/go.git
net/http: correct use of byte slice in js syscall
syscall/js does not allow []byte to be used in direct inputs to
its JavaScript manipulation methods since
bafe466a95.
Unfortunately, this use of a byte slice was missed, so any
uses of the WASM Roundtripper with a body will panic.
This ensures the byte slice is appropriately converted
before being passed to syscall.
Fixes #26349
This commit is contained in:
parent
3df1f00bfc
commit
3914bda2ff
|
|
@ -60,7 +60,9 @@ func (t *Transport) RoundTrip(req *Request) (*Response, error) {
|
|||
return nil, err
|
||||
}
|
||||
req.Body.Close()
|
||||
opt.Set("body", body)
|
||||
a := js.TypedArrayOf(body)
|
||||
defer a.Release()
|
||||
opt.Set("body", a)
|
||||
}
|
||||
respPromise := js.Global().Call("fetch", req.URL.String(), opt)
|
||||
var (
|
||||
|
|
|
|||
Loading…
Reference in New Issue