hasBody function
Matcher
hasBody(
- dynamic bodyMatcher
Validates that TestResponse has a decoded body that matches bodyMatcher
.
The body of the actual response will be decoded according to its content-type
before being evaluated. For example, a JSON object encoded as
'application/json' will become a Map
. If the body cannot
be decoded or is decoded into the wrong type, this matcher
will fail.
var response = await client.request("/foo").get();
expect(response, hasBody({
"key": "value"
));
Implementation
Matcher hasBody(dynamic bodyMatcher) =>
HTTPResponseMatcher(null, null, HTTPBodyMatcher(bodyMatcher));