hasBody function Null safety

Matcher hasBody(
  1. 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"


Matcher hasBody(dynamic bodyMatcher) =>
    HTTPResponseMatcher(null, null, HTTPBodyMatcher(bodyMatcher));