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); |
} |