Skip to content

Commit 3246f95

Browse files
committed
Properly handle null field values when encoding requests. See: #75
1 parent 9959796 commit 3246f95

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/src/utils.dart

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import 'byte_stream.dart';
1313
/// mapToQuery({"foo": "bar", "baz": "bang"});
1414
/// //=> "foo=bar&baz=bang"
1515
String mapToQuery(Map<String, String> map, {Encoding encoding}) {
16+
map.keys
17+
.where((k) => (map[k] == null)).toList() // -- keys for null elements
18+
.forEach(map.remove);
19+
1620
var pairs = <List<String>>[];
1721
map.forEach((key, value) =>
1822
pairs.add([Uri.encodeQueryComponent(key, encoding: encoding),

0 commit comments

Comments
 (0)