bodyIs<T> function

Checker<Response<T>> bodyIs <T>(
  1. T expected,
  2. [bool isEqual(
    1. T a,
    2. T b
    )]
)

Implementation

Checker<Response<T>> bodyIs<T>(T expected, [bool isEqual(T a, T b)]) =>
    (Response<T> resp) {
      bool equal = isEqual != null
          ? isEqual(expected, resp.body)
          : expected == resp.body;
      if (!equal)
        return <Mismatch>[
          new EqualityMismatch(expected, resp.body,
              customMessage: (m) =>
                  'Expected body ${m.expected} but found ${m.actual}!')
        ];
      return <Mismatch>[];
    };