net/http: no way to set Fetch options when making outgoing http calls with js/wasm #26769
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
Yes, this is known. Currently, there is no good way to expose fetch parameters from user level to the
See a very small discussion here - https://go-review.googlesource.com/c/go/+/114515/8/src/net/http/roundtrip_js.go#34
The main tracking issue for a better wasm http client is #25695. I would suggest that you comment on that issue with your suggestions on how best we can take this forward.
changed the title
Wasm: No way to set fetch options when making outgoing http calls
Aug 2, 2018
These are settings which arise only in a browser context. So as I see, there is no clear way to map them in Go.
We also have
See here for remaining options - https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters
referenced this issue
Aug 3, 2018
@johanbrandhorst thanks for the quick turnaround on this issue. One quick comment I have on your PR. As a stop gap and until we can rehaul parts of the client, I see no problems with this approach. On the other hand I am really not inclined with the solution as presented if it this is going to be the long term answer. The idea that @bradfitz had about using
@agnivade What other options do you think would be reasonable to expose via the header mechanism? I hesitate to close this issue until we cover all the existing options at least. Using your link we have:
Covered by existing API
Not sure if there's some existing API we can map this to
Could presumably be configured via a header like the others.
Could be configured via a header. This seems to affect the
This is surely impossible for us to emulate? Or if we can figure out how this is calculated perhaps we could always send it?
This too might map to some existing API?
For keepalive, we have this https://golang.org/pkg/net/http/#Transport.DisableKeepAlives. Is it possible to map to that ?
Other than that, I would just want to add
I don't think they mean the same concept of