-
Notifications
You must be signed in to change notification settings - Fork 362
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
Switch browser_client.dart to use fetch #1401
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthBreaking changes ✔️
Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs.
Coverage
|
File | Coverage |
---|---|
pkgs/http/lib/src/browser_client.dart | 💔 Not covered |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check
.
API leaks ✔️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
Package | Leaked API symbols |
---|
License Headers ✔️
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files |
---|
no missing headers |
All source files should start with a license header.
Unrelated files missing license headers
Files |
---|
pkgs/cronet_http/lib/src/jni/jni_bindings.dart |
pkgs/cupertino_http/lib/src/native_cupertino_bindings.dart |
pkgs/http/example/main.dart |
pkgs/http2/test/src/flowcontrol/mocks.mocks.dart |
pkgs/http_client_conformance_tests/example/client_test.dart |
pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/dummy_isolate.dart |
pkgs/http_client_conformance_tests/lib/src/multipart_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/multipart_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/request_cookies_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/request_cookies_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/response_cookies_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/response_cookies_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart |
pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart |
pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart |
pkgs/http_parser/test/example_test.dart |
pkgs/http_profile/lib/http_profile.dart |
pkgs/ok_http/lib/src/jni/bindings.dart |
pkgs/web_socket/example/web_socket_example.dart |
pkgs/web_socket/lib/testing.dart |
pkgs/web_socket_conformance_tests/example/client_test.dart |
pkgs/web_socket_conformance_tests/lib/src/close_local_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/close_local_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/close_remote_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/close_remote_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/continuously_writing_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/disconnect_after_upgrade_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/echo_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/echo_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/no_upgrade_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/peer_protocol_errors_server_web.dart |
pkgs/web_socket_conformance_tests/lib/src/protocol_server_vm.dart |
pkgs/web_socket_conformance_tests/lib/src/protocol_server_web.dart |
Nice! There are some lints to fix here. |
Fixing the lints now. I am a bit surprised that I don't get them in the IDE.
Yeah, I am typing the comment on the issue now. tldr is that even when browser supports streaming request it can still refuse to do it if the server is not HTTP/2 or QUIC... Which means we can't really use it by default because it will potentially cause existing code to fail (even if we sniff browser compatibility - which by itself is a non-trivial thing to do :-/). I am honestly surprised how nasty browser implementation is - it does not even provide any useful information in the error message when this happens and you need to go look into the console to see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to be you when I grow up.
I will wait landing this before we can get dev coverage. Don't want to land it with a broken CI.
Do you have something specific in mind? I have tested firefox and safari locally and both work (though Footnotes
|
Yeah, that was what I was thinking - but I guess that won't work out right now. It looks like the checks are exceeding except for these tests:
|
I fixed 3.4 tests |
What's the associated bug? Can resolve/close as well? |
Thanks @mraleph! This is great. I think reading request into memory still means it's going to blow up even when StreamedRequest could be streamed: But, at least it puts the parts in place to enable some solutions to those problems. Think what needs to be figured out is how do we get something other than a byte array to here: Not sure the proper platform neutral abstraction for the library, but if there was a way to go something like: import "package:http/web.dart";
import "package:web/web.dart" as web;
client.send(WebRequest(web.RequestBody)); At least that would provide some kind of path to do a file upload or manually pass a stream if you want. |
I am planning to look at request streaming as well, because I have already loaded the context into my head so it makes sense to do something before it gets paged out. |
Revisions updated by `dart tools/rev_sdk_deps.dart`. dartdoc (https://github.com/dart-lang/dartdoc/compare/6bbd3d7..f8a55e4): f8a55e4b 2024-11-18 Parker Lougheed Remove unused build config (dart-lang/dartdoc#3923) fa339a10 2024-11-15 Sam Rawlins Refactor how Object and Pragma are discovered and handled (dart-lang/dartdoc#3929) http (https://github.com/dart-lang/http/compare/2f954e1..e37093f): e37093f 2024-11-15 Brian Quinlan Upgrade to `package:`objective_c` 4.0 (dart-lang/http#1406) e509abb 2024-11-14 Slava Egorov Switch browser_client.dart to use fetch (dart-lang/http#1401) yaml_edit (https://github.com/dart-lang/yaml_edit/compare/3d1421b..8bd0fdf): 8bd0fdf 2024-11-18 Kevin Moore Fix unused param in a private ctor lint (dart-lang/yaml_edit#99) Change-Id: I12a74dc3bce629c213d26fbb6e76fc3c19a443dd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396422 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Devon Carew <[email protected]>
Rewrite
browser_client.dart
to usefetch
instead of XHR.