| 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.
|
|
|