Index: pkg/http/lib/src/client.dart |
diff --git a/pkg/http/lib/src/client.dart b/pkg/http/lib/src/client.dart |
index 68c906772831925bfb3cb52f8c3feb0fd09d7c0f..e29a9e0c31a6df8a142b2bae80f7c84fc970ba3a 100644 |
--- a/pkg/http/lib/src/client.dart |
+++ b/pkg/http/lib/src/client.dart |
@@ -10,9 +10,10 @@ import 'dart:typed_data'; |
import 'base_client.dart'; |
import 'base_request.dart'; |
+import 'io.dart' as io; |
import 'io_client.dart'; |
-import 'streamed_response.dart'; |
import 'response.dart'; |
+import 'streamed_response.dart'; |
/// The interface for HTTP clients that take care of maintaining persistent |
/// connections across multiple requests to the same server. If you only need to |
@@ -24,9 +25,15 @@ import 'response.dart'; |
/// another instance of [Client] and add functionality on top of that. This |
/// allows all classes implementing [Client] to be mutually composable. |
abstract class Client { |
- /// Creates a new Client using the default implementation. This implementation |
- /// uses an underlying `dart:io` [HttpClient] to make requests. |
- factory Client() => new IOClient(); |
+ /// Creates a new client. |
+ /// |
+ /// Currently this will create an [IOClient] if `dart:io` is available and |
+ /// throw an [UnsupportedError] otherwise. In the future, it will create a |
+ /// [BrowserClient] if `dart:html` is available. |
+ factory Client() { |
+ io.assertSupported("IOClient"); |
+ return new IOClient(); |
+ } |
/// Sends an HTTP HEAD request with the given headers to the given URL, which |
/// can be a [Uri] or a [String]. |