body method

Future<ResponseExpect> body(
  1. Object expected
)

Asserts the response body matches the expected value.

This method is async.

Implementation

Future<ResponseExpect> body(Object expected) async {
  final body = await _response.body;
  if (expected is Matcher) {
    if (!expected.matches(body, {})) {
      throw ChaseTestFailure('Body "$body" did not match expected');
    }
  } else if (body != expected.toString()) {
    throw ChaseTestFailure('Expected body "$expected" but got "$body"');
  }
  return this;
}