The Go http.Transport interface implemented over the WHATWG Fetch API using the WebAssembly arch target.
This package requires the Go WASM compilation target to be supported. Short example:
c := http.Client{
Transport: &fetch.Transport{},
}
resp, err := c.Get("https://api.github.com")
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(b))
See my wasm-experiments repo for the full example of its use.
The code is largely based on the Fetch API implementation in GopherJS.