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

Unified Diff: pkg/http/lib/src/io_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/io.dart ('k') | pkg/http/lib/src/multipart_file.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/io_client.dart
diff --git a/pkg/http/lib/src/io_client.dart b/pkg/http/lib/src/io_client.dart
index b5e481528c6d3fd6d5407864a847a920b29ab6c3..9fd81acdfa865e1899dc26622edfdac8ca461989 100644
--- a/pkg/http/lib/src/io_client.dart
+++ b/pkg/http/lib/src/io_client.dart
@@ -5,22 +5,25 @@
library io_client;
import 'dart:async';
-import 'dart:io';
import 'package:stack_trace/stack_trace.dart';
import 'base_client.dart';
import 'base_request.dart';
import 'exception.dart';
+import 'io.dart' as io;
import 'streamed_response.dart';
/// A `dart:io`-based HTTP client. This is the default client.
class IOClient extends BaseClient {
/// The underlying `dart:io` HTTP client.
- HttpClient _inner;
+ var _inner;
/// Creates a new HTTP client.
- IOClient() : _inner = new HttpClient();
+ IOClient() {
+ io.assertSupported("IOClient");
+ _inner = io.newHttpClient();
+ }
/// Sends an HTTP request and asynchronously returns the response.
Future<StreamedResponse> send(BaseRequest request) {
@@ -50,7 +53,7 @@ class IOClient extends BaseClient {
return new StreamedResponse(
response.handleError((error) =>
throw new ClientException(error.message, error.uri),
- test: (error) => error is HttpException),
+ test: (error) => io.isHttpException(error)),
response.statusCode,
contentLength: contentLength,
request: request,
@@ -59,7 +62,7 @@ class IOClient extends BaseClient {
persistentConnection: response.persistentConnection,
reasonPhrase: response.reasonPhrase);
}).catchError((error) {
- if (error is! HttpException) throw error;
+ if (!io.isHttpException(error)) throw error;
throw new ClientException(error.message, error.uri);
});
}
« no previous file with comments | « pkg/http/lib/src/io.dart ('k') | pkg/http/lib/src/multipart_file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698