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

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

Issue 11825010: Update pkg/http to use the new async APIs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 11 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 | « no previous file | pkg/http/lib/src/base_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/http.dart
diff --git a/pkg/http/lib/http.dart b/pkg/http/lib/http.dart
index 618cd77f6592c5a2dd1a3a7a590ac23fdb19fb40..dde9f29c6594c0a55a07114b3b236aa2de475d22 100644
--- a/pkg/http/lib/http.dart
+++ b/pkg/http/lib/http.dart
@@ -28,7 +28,7 @@
/// fields: {"name": "doodle", "color": "blue"})
/// .then((response) => client.get(response.bodyFields['uri']))
/// .then((response) => print(response.body))
-/// .onComplete((_) => client.close());
+/// .whenComplete(client.close);
///
/// You can also exert more fine-grained control over your requests and
/// responses by creating [Request] or [StreamedRequest] objects yourself and
@@ -63,6 +63,7 @@ import 'src/response.dart';
export 'src/base_client.dart';
export 'src/base_request.dart';
export 'src/base_response.dart';
+export 'src/byte_stream.dart';
export 'src/client.dart';
export 'src/multipart_file.dart';
export 'src/multipart_request.dart';
@@ -169,6 +170,5 @@ Future<Uint8List> readBytes(url, {Map<String, String> headers}) =>
Future _withClient(Future fn(Client)) {
var client = new Client();
var future = fn(client);
- future.catchError((_) {}).then((_) => client.close());
- return future;
+ return future.whenComplete(client.close);
}
« no previous file with comments | « no previous file | pkg/http/lib/src/base_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698