Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: Expose the normal transport RoundTripper for WASM/js #27495
On WASM, the standard
There are use cases for using the normal RoundTripper, for instance for testing and simulation in the browser. The normal RoundTripper is compiled and included in the binary anyway, and works perfectly well, but is masked by the browser version.
What version of Go are you using (
I quickly tested two hacks to do this, and both seemed to work. Both pass the tests on normal platforms, but I don't know how to run the unit tests on WASM.
Hack 1: Don't implement the special RoundTripper on
Hack 2: Mod the special RoundTripper to instead use the normal RoundTripper if the caller has set options on the Transport. Example: 8137bf5
running into this problem when trying to do HTTPS requests in wasm/js (using self signed certs over a websocket connection).
e8050da seems like an easy and clean solution to enable a lot more flexibility when desired.
as far as I can tell the only place where
I understand #25695 discusses a more major problem, but specially considering the impact of fixing that as a whole, maybe a simple fix like this would be a good start?