-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: add js/wasm compatible DefaultTransport #25550
Conversation
This PR (HEAD: 33bfd52) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
This PR (HEAD: b1f46d7) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
This PR (HEAD: 1bdaafc) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit Bot: Uploaded patch set 3: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Brad Fitzpatrick: Patch Set 3: Run-TryBot+1 TryBot-Result+1 (12 comments) Thanks! Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Dmitri Shuralyov: Patch Set 3: (1 comment) http.Transport type is documented as:
When I originally wrote this functionality in GopherJS, I started by doing it at the http.RoundTripper level and was hoping to implement as much of its semantics as possible. Getting response body streaming was my main motivation, and the XHR transport was already implemented at http.RoundTripper level too, so it was a quick decision. Over time, I learned that both XHR and Fetch browser APIs are higher level and don't allow making individual HTTP requests. Due to security reasons and things like CORS, the frontend code doesn't actually ever get Redirect responses, only the final redirect destination. Fetch also deals with caching, credentials, etc. I didn't want to touch this decision for GopherJS because it was more of a prototype, but since this is the real Go tree, perhaps we should revisit the decision of what abstraction level to implement this at. I haven't prototyped it yet, but given what I've seen so far, I suspect that implementing the HTTP client in browsers at the http.Client level may be a closer fit to what browsers allow client code to do. Thoughts (Brad, Johan, Richard)? Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: 7c13eba) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 4: (7 comments) Redesigned following Brad's suggestions. Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: f847d94) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
This PR (HEAD: 4532afa) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Johan Brandhorst: Patch Set 6: I'm slightly confused, as with the changes applied I can't seem to run johan@johan-x1 ~/gows/src/github.com/johanbrandhorst/go/src $ ./all.bash net/httpsrc/net/http/client.go:307:3: impossible type switch case: rt (type RoundTripper) cannot have dynamic type *Transport (wrong type for RoundTrip method) Now I think I have correctly defined Transport both in the case of js,wasm and !js,wasm. Am I missing anything obvious? Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Johan Brandhorst: Patch Set 6:
I'm not sure I understand how this would apply here - wouldn't we still need a custom Transport implementation? If we defined a js,wasm specific client presumably it'd still need to have all the same fields as the normal client. Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Dmitri Shuralyov: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: dd97b7f) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 7: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Johan Brandhorst: Patch Set 7: (6 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: 254d2df) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Agniva De Sarker: Patch Set 8: (3 comments) A minor review from a wasm enthusiast. Thanks for your work. :) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: a3dde72) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 8: (3 comments)
Thanks, great points all! Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Johan Brandhorst: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Johan Brandhorst: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Agniva De Sarker: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Johan Brandhorst: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: c068b7f) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Brad Fitzpatrick: Patch Set 10: Run-TryBot+1 Code-Review+1 (6 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Gobot Gobot: Patch Set 10: TryBots beginning. Status page: https://farmer.golang.org/try?commit=509e3082 Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Brad Fitzpatrick: Patch Set 10: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Brad Fitzpatrick: Patch Set 10:
Good point, but I'm more concerned with more code working by default without changes, so I think this is okay to violate for now in Go 1.11. We can revisit in Go 1.12 & later. Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Gobot Gobot: Patch Set 10: Build is still in progress... Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report. Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: 630957c) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 10: (8 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
This PR (HEAD: 49b5acc) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
This PR (HEAD: a710973) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Brad Fitzpatrick: Patch Set 13: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Gobot Gobot: Patch Set 13: TryBots beginning. Status page: https://farmer.golang.org/try?commit=80f0fd2f Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Gobot Gobot: Patch Set 13: TryBot-Result+1 TryBots are happy. Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Brad Fitzpatrick: Patch Set 13: Code-Review+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Adds a new Transport type for the js/wasm target that uses the JavaScript Fetch API for sending HTTP requests. Support for streaming response bodies is used when available, falling back to reading the entire response into memory at once.
This PR (HEAD: 6df6467) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/go/+/114515 to see it. Tip: You can toggle comments from me using the |
Message from Johan Brandhorst: Patch Set 13: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Message from Brad Fitzpatrick: Patch Set 14: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/114515. |
Adds a new Transport type for the js/wasm target that uses the JavaScript Fetch API for sending HTTP requests. Support for streaming response bodies is used when available, falling back to reading the entire response into memory at once. Updates #25506 Change-Id: Ie9ea433a1a2ed2f65b03c6cc84a16e70c06fcf5c GitHub-Last-Rev: 6df6467 GitHub-Pull-Request: #25550 Reviewed-on: https://go-review.googlesource.com/114515 Reviewed-by: Brad Fitzpatrick <[email protected]>
This PR is being closed because golang.org/cl/114515 has been merged. |
Adds a new Transport type for the js/wasm target that uses the JavaScript Fetch API for sending HTTP requests. Support for streaming response bodies is used when available, falling back to reading the entire response into memory at once. Updates #25506 Change-Id: Ie9ea433a1a2ed2f65b03c6cc84a16e70c06fcf5c GitHub-Last-Rev: 6df646745b8e0474781f4b1a3084536e573e8e8c GitHub-Pull-Request: golang/go#25550 Reviewed-on: https://go-review.googlesource.com/114515 Reviewed-by: Brad Fitzpatrick <[email protected]>
Adds a new Transport type for the js/wasm target that uses the
JavaScript Fetch API for sending HTTP requests. Support for
streaming response bodies is used when available, falling back
to reading the entire response into memory at once.
Updates #25506