bodyIs function
bodyIs checks the response body.
if bodyOrMatcher
is matcher bodyIs creates a
_CustomBodyMatcher
instance, else creates _BodyMatcher
instance and checks the response body with these matchers.
Example:
tester("/path/to" , bodyIs({"hello" : "world"}))
native equals:
//.. get response
test(response.body, eq({"hello" : "world"}))
OR use with matcher
tester("/path/to" , bodyIs(contains("hello")))
native equals:
//.. get response
test(response.body, contains("hello"))
Implementation
Matcher bodyIs(dynamic bodyOrMatcher) {
if (bodyOrMatcher is Matcher) {
return _CustomBodyMatcher._(bodyOrMatcher);
}
return _BodyMatcher._(bodyOrMatcher);
}