-
Notifications
You must be signed in to change notification settings - Fork 389
Description
The doc comment says that the body "can be a String, a List<int> or a Map<String, String>." however we allow any List or Map and then enforce the value types with a cast.
Lines 85 to 87 in 778174b
| request.bodyBytes = body.cast<int>(); | |
| } else if (body is Map) { | |
| request.bodyFields = body.cast<String, String>(); |
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 any List that happens to contain only String values, and same for Map. 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