2023-04-11 21:33:52 +09:00

18 lines
411 B
Go

package fetch
import (
"net/http"
"syscall/js"
)
// transport is an implementation of http.RoundTripper
type transport struct {
// namespace - Objects that Fetch API belongs to. Default is Global
namespace js.Value
}
// RoundTrip replaces http.DefaultTransport.RoundTrip to use cloudflare fetch
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
return fetch(t.namespace, req)
}