Update platform-specific imports for wasm (#1051)
Fix some docs
diff --git a/pkgs/flutter_http_example/lib/main.dart b/pkgs/flutter_http_example/lib/main.dart
index 70f003c..406b9e6 100644
--- a/pkgs/flutter_http_example/lib/main.dart
+++ b/pkgs/flutter_http_example/lib/main.dart
@@ -11,7 +11,7 @@
import 'book.dart';
import 'http_client_factory.dart'
- if (dart.library.html) 'http_client_factory_web.dart' as http_factory;
+ if (dart.library.js_interop) 'http_client_factory_web.dart' as http_factory;
void main() {
// `runWithClient` is used to control which `package:http` `Client` is used
diff --git a/pkgs/http/lib/src/browser_client.dart b/pkgs/http/lib/src/browser_client.dart
index 10d8e0c..80db8b1 100644
--- a/pkgs/http/lib/src/browser_client.dart
+++ b/pkgs/http/lib/src/browser_client.dart
@@ -26,8 +26,8 @@
return BrowserClient();
}
-/// A `dart:html`-based HTTP client that runs in the browser and is backed by
-/// XMLHttpRequests.
+/// A `package:web`-based HTTP client that runs in the browser and is backed by
+/// [XMLHttpRequest].
///
/// This client inherits some of the limitations of XMLHttpRequest. It ignores
/// the [BaseRequest.contentLength], [BaseRequest.persistentConnection],
diff --git a/pkgs/http/lib/src/client.dart b/pkgs/http/lib/src/client.dart
index 85d933a..7429ca8 100644
--- a/pkgs/http/lib/src/client.dart
+++ b/pkgs/http/lib/src/client.dart
@@ -37,7 +37,8 @@
/// Creates a new platform appropriate client.
///
/// Creates an `IOClient` if `dart:io` is available and a `BrowserClient` if
- /// `dart:html` is available, otherwise it will throw an unsupported error.
+ /// `dart:js_interop` is available, otherwise it will throw an unsupported
+ /// error.
factory Client() => zoneClient ?? createClient();
/// Sends an HTTP HEAD request with the given headers to the given URL.
diff --git a/pkgs/http_client_conformance_tests/lib/src/close_tests.dart b/pkgs/http_client_conformance_tests/lib/src/close_tests.dart
index 040b338..8194130 100644
--- a/pkgs/http_client_conformance_tests/lib/src/close_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/close_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'request_body_server_vm.dart'
- if (dart.library.html) 'request_body_server_web.dart';
+ if (dart.library.js_interop) 'request_body_server_web.dart';
/// Tests that the [Client] correctly implements [Client.close].
void testClose(Client Function() clientFactory) {
diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart
index 3ce871b..2395aaf 100644
--- a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'compressed_response_body_server_vm.dart'
- if (dart.library.html) 'compressed_response_body_server_web.dart';
+ if (dart.library.js_interop) 'compressed_response_body_server_web.dart';
/// Tests that the [Client] correctly implements HTTP responses with compressed
/// bodies.
diff --git a/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart b/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart
index b4ac8b2..6b296a2 100644
--- a/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart
@@ -2,7 +2,7 @@
// 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.
-import 'dart:isolate' if (dart.library.html) 'dummy_isolate.dart';
+import 'dart:isolate' if (dart.library.js_interop) 'dummy_isolate.dart';
import 'package:async/async.dart';
import 'package:http/http.dart';
@@ -10,7 +10,7 @@
import 'package:test/test.dart';
import 'request_body_server_vm.dart'
- if (dart.library.html) 'request_body_server_web.dart';
+ if (dart.library.js_interop) 'request_body_server_web.dart';
Future<void> _testPost(Client Function() clientFactory, String host) async {
await Isolate.run(
diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart
index be9c4d9..8f8dc81 100644
--- a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'multiple_clients_server_vm.dart'
- if (dart.library.html) 'multiple_clients_server_web.dart';
+ if (dart.library.js_interop) 'multiple_clients_server_web.dart';
/// Tests that the [Client] works correctly if there are many used
/// simultaneously.
diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart
index e21a5c2..600becc 100644
--- a/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'redirect_server_vm.dart'
- if (dart.library.html) 'redirect_server_web.dart';
+ if (dart.library.js_interop) 'redirect_server_web.dart';
/// Tests that the [Client] correctly implements HTTP redirect logic.
///
diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart
index 560858d..8c0c658 100644
--- a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart
@@ -11,7 +11,7 @@
import 'package:test/test.dart';
import 'request_body_streamed_server_vm.dart'
- if (dart.library.html) 'request_body_streamed_server_web.dart';
+ if (dart.library.js_interop) 'request_body_streamed_server_web.dart';
/// Tests that the [Client] correctly implements streamed request body
/// uploading.
diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart
index e211da5..2f13fa7 100644
--- a/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart
@@ -10,7 +10,7 @@
import 'package:test/test.dart';
import 'request_body_server_vm.dart'
- if (dart.library.html) 'request_body_server_web.dart';
+ if (dart.library.js_interop) 'request_body_server_web.dart';
class _Plus2Decoder extends Converter<List<int>, String> {
@override
diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart
index 8adf98c..a694387 100644
--- a/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'request_headers_server_vm.dart'
- if (dart.library.html) 'request_headers_server_web.dart';
+ if (dart.library.js_interop) 'request_headers_server_web.dart';
/// Tests that the [Client] correctly sends headers in the request.
void testRequestHeaders(Client client) async {
diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart
index 28686fa..b8afa3d 100644
--- a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart
@@ -10,7 +10,7 @@
import 'package:test/test.dart';
import 'response_body_streamed_server_vm.dart'
- if (dart.library.html) 'response_body_streamed_server_web.dart';
+ if (dart.library.js_interop) 'response_body_streamed_server_web.dart';
/// Tests that the [Client] correctly implements HTTP responses with bodies of
/// unbounded size.
diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart
index 91ee549..ba833f4 100644
--- a/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'response_body_server_vm.dart'
- if (dart.library.html) 'response_body_server_web.dart';
+ if (dart.library.js_interop) 'response_body_server_web.dart';
/// Tests that the [Client] correctly implements HTTP responses with bodies.
///
diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart
index 4f92042..6a3647b 100644
--- a/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'response_headers_server_vm.dart'
- if (dart.library.html) 'response_headers_server_web.dart';
+ if (dart.library.js_interop) 'response_headers_server_web.dart';
/// Tests that the [Client] correctly processes response headers.
void testResponseHeaders(Client client) async {
diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart
index b618fa0..12fb29c 100644
--- a/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'response_status_line_server_vm.dart'
- if (dart.library.html) 'response_status_line_server_web.dart';
+ if (dart.library.js_interop) 'response_status_line_server_web.dart';
/// Tests that the [Client] correctly processes the response status line (e.g.
/// 'HTTP/1.1 200 OK\r\n').
diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart
index 65de499..0e45bc5 100644
--- a/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart
+++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'server_errors_server_vm.dart'
- if (dart.library.html) 'server_errors_server_web.dart';
+ if (dart.library.js_interop) 'server_errors_server_web.dart';
/// Tests that the [Client] correctly handles server errors.
void testServerErrors(Client client, {bool redirectAlwaysAllowed = false}) {