exact method

void exact({
  1. int? statusCode,
  2. String? body,
  3. List<int>? bytes,
  4. String? mimeType,
  5. String? encoding,
  6. Map<String, String>? headers,
  7. int? contentLength,
})

Implementation

void exact(
    {int? statusCode,
    String? body,
    List<int>? bytes,
    String? mimeType,
    String? encoding,
    Map<String, String>? headers,
    int? contentLength}) {
  final conditions = <Checker<http.Response>>[];
  if (statusCode != null) {
    conditions.add(statusCodeIs(statusCode));
  }
  if (body != null) {
    conditions.add(bodyIs(body));
  }
  if (bytes != null) {
    conditions.add(bodyBytesIs(bytes));
  }
  if (mimeType != null) {
    conditions.add(mimeTypeIs(mimeType));
  }
  if (encoding != null) {
    conditions.add(encodingIs(encoding));
  }
  if (headers != null) {
    headers.forEach(
        (String key, String value) => conditions.add(headersHas(key, value)));
  }
  return expect(conditions);
}