Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1255)

Unified Diff: pkg/http/lib/src/client.dart

Issue 261763002: Rip out the last dart:io dependency from pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/lib/src/byte_stream.dart ('k') | pkg/http/lib/src/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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].
« no previous file with comments | « pkg/http/lib/src/byte_stream.dart ('k') | pkg/http/lib/src/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698