Add better feedback around the types for body
argument
#652
Labels
next-breaking-release
Issues that are worth doing but need to wait for a breaking version bump
The doc comment says that the body "can be a
String
, aList<int>
or aMap<String, String>
." however we allow anyList
orMap
and then enforce the value types with acast
.http/lib/src/base_client.dart
Lines 85 to 87 in 778174b
This is unnecessarily loose and may make the errors harder to diagnose. See error/stack in #644
I think we should consider making this more strict - require a
List<String>
instead of anyList
that happens to contain onlyString
values, and same forMap
. If we decide to do that we should only change it in the next major version.We could also consider treating it as non-breaking to add an
assert
to help catch this kind of thing in tests. There are only a few existing cases that need to get fixed internally.WDYT @lrhn @jakemac53 @kevmoo
The text was updated successfully, but these errors were encountered: