Allow any Map<String, dynamic> as body, not just Map<String, String>
This commit is contained in:
parent
6c9379698a
commit
47ccb07218
2 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
# 2.0.2
|
# 2.0.2
|
||||||
* `_join` previously discarded quer parameters, etc.
|
* `_join` previously discarded quer parameters, etc.
|
||||||
|
* Allow any `Map<String, dynamic>` as body, not just `Map<String, String>`.
|
||||||
|
|
||||||
# 2.0.1
|
# 2.0.1
|
||||||
* Change `BaseAngelClient` constructor to accept `dynamic` instead of `String` for `baseUrl.
|
* Change `BaseAngelClient` constructor to accept `dynamic` instead of `String` for `baseUrl.
|
||||||
|
|
|
@ -138,8 +138,9 @@ abstract class BaseAngelClient extends Angel {
|
||||||
request.body = body;
|
request.body = body;
|
||||||
} else if (body is List<int>) {
|
} else if (body is List<int>) {
|
||||||
request.bodyBytes = new List<int>.from(body);
|
request.bodyBytes = new List<int>.from(body);
|
||||||
} else if (body is Map<String, String>) {
|
} else if (body is Map<String, dynamic>) {
|
||||||
request.bodyFields = new Map<String, String>.from(body);
|
request.bodyFields =
|
||||||
|
body.map((k, v) => MapEntry(k, v is String ? v : v.toString()));
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentError.value(body, 'body',
|
throw new ArgumentError.value(body, 'body',
|
||||||
'must be a String, List<int>, or Map<String, String>.');
|
'must be a String, List<int>, or Map<String, String>.');
|
||||||
|
|
Loading…
Reference in a new issue