Index: lib/src/base_client.dart |
diff --git a/lib/src/base_client.dart b/lib/src/base_client.dart |
index ad85a67114194911e1fbb3a750268ea6cd987476..b029601c196680237d9aad92627ff3711f4ac15c 100644 |
--- a/lib/src/base_client.dart |
+++ b/lib/src/base_client.dart |
@@ -14,7 +14,6 @@ import 'exception.dart'; |
import 'request.dart'; |
import 'response.dart'; |
import 'streamed_response.dart'; |
-import 'utils.dart'; |
/// The abstract base class for an HTTP client. This is a mixin-style class; |
/// subclasses only need to implement [send] and maybe [close], and then they |
@@ -151,26 +150,25 @@ abstract class BaseClient implements Client { |
/// Sends a non-streaming [Request] and returns a non-streaming [Response]. |
Future<Response> _sendUnstreamed(String method, url, |
Map<String, String> headers, [body, Encoding encoding]) { |
- return syncFuture(() { |
nweiz
2015/08/25 23:25:00
If you're going to remove this, make the function
kevmoo
2015/08/27 21:14:20
Done - updated min SDK to 1.9
|
- if (url is String) url = Uri.parse(url); |
- var request = new Request(method, url); |
- |
- if (headers != null) request.headers.addAll(headers); |
- if (encoding != null) request.encoding = encoding; |
- if (body != null) { |
- if (body is String) { |
- request.body = body; |
- } else if (body is List) { |
- request.bodyBytes = body; |
- } else if (body is Map) { |
- request.bodyFields = body; |
- } else { |
- throw new ArgumentError('Invalid request body "$body".'); |
- } |
+ |
+ if (url is String) url = Uri.parse(url); |
+ var request = new Request(method, url); |
+ |
+ if (headers != null) request.headers.addAll(headers); |
+ if (encoding != null) request.encoding = encoding; |
+ if (body != null) { |
+ if (body is String) { |
+ request.body = body; |
+ } else if (body is List) { |
+ request.bodyBytes = body; |
+ } else if (body is Map) { |
+ request.bodyFields = body; |
+ } else { |
+ throw new ArgumentError('Invalid request body "$body".'); |
} |
+ } |
- return send(request); |
- }).then(Response.fromStream); |
+ return send(request).then(Response.fromStream); |
} |
/// Throws an error if [response] is not successful. |