You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
compiler/natives/src/net/http: Implement http.RoundTripper using Fetch API.
The motivation to use Fetch API is because it's lower level, and allows
implementing an http.RoundTripper more efficiently (less conversions
between strings and []byte). It also supports streaming body responses
efficiently.
req.Cancel is partially supported; it gets RoundTrip to return right away,
but may not cancel the underlying request that the browser will make. It
is still on the roadmap for Fetch API to add support for canceling requests,
once done, this can be improved. CancelRequest(*http.Request) is not implemented
because that method is deprecated.
Dynamically determine which of Fetch, XMLHttpRequest APIs are available and
gracefully fallback to the best available API, if any.
Tested in stable channel of Chrome, latest Safari, Firefox (developer
edition). Only stable Chrome appears to support Fetch API with streaming
response bodies at time of testing (Firefox supports Fetch API but not yet
streaming response bodies), but all modern browsers have WIP implementations
at HEAD, so it's only a matter of time before they (seamlessly) benefit from
this patch.
References:
- https://fetch.spec.whatwg.org/
- https://streams.spec.whatwg.org/
- http://caniuse.com/#search=Fetch
Regenerate compiler/natives/fs_vfsdata.go:
go generate github.com/gopherjs/gopherjs/...
Closes#454.
0 commit comments