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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « pkg/http/lib/http.dart ('k') | pkg/http/lib/src/base_request.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/base_client.dart
diff --git a/pkg/http/lib/src/base_client.dart b/pkg/http/lib/src/base_client.dart
index 1662f003719e6aaae0bc44d15d06f0ba32c911e9..d3a3736897f94405afd3c032e9c830f5647232c3 100644
--- a/pkg/http/lib/src/base_client.dart
+++ b/pkg/http/lib/src/base_client.dart
@@ -4,6 +4,7 @@
library base_client;
+import 'dart:async';
import 'dart:io';
import 'dart:scalarlist';
import 'dart:uri';
@@ -72,7 +73,7 @@ abstract class BaseClient implements Client {
/// For more fine-grained control over the request and response, use [send] or
/// [get] instead.
Future<String> read(url, {Map<String, String> headers}) {
- return get(url, headers: headers).transform((response) {
+ return get(url, headers: headers).then((response) {
_checkResponseSuccess(url, response);
return response.body;
});
@@ -88,7 +89,7 @@ abstract class BaseClient implements Client {
/// For more fine-grained control over the request and response, use [send] or
/// [get] instead.
Future<Uint8List> readBytes(url, {Map<String, String> headers}) {
- return get(url, headers: headers).transform((response) {
+ return get(url, headers: headers).then((response) {
_checkResponseSuccess(url, response);
return response.bodyBytes;
});
@@ -108,7 +109,7 @@ abstract class BaseClient implements Client {
[Map<String, String> fields]) {
// Wrap everything in a Future block so that synchronous validation errors
// are passed asynchronously through the Future chain.
- return async.chain((_) {
+ return async.then((_) {
if (url is String) url = new Uri.fromString(url);
var request = new Request(method, url);
@@ -116,7 +117,7 @@ abstract class BaseClient implements Client {
if (fields != null && !fields.isEmpty) request.bodyFields = fields;
return send(request);
- }).chain(Response.fromStream);
+ }).then(Response.fromStream);
}
/// Throws an error if [response] is not successful.
« no previous file with comments | « pkg/http/lib/http.dart ('k') | pkg/http/lib/src/base_request.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698