expectMultiple method

List<JSON> expectMultiple()

Returns the List of JSON objects in the response body.

Throws an AssertionError if the response body is null or not an array.

Implementation

List<JSON> expectMultiple() {
  assert(isOk,
      "Response does not indicate success (status code: $statusCode). This should not happen. Try to call isOk and implement your own custom error handling before calling this method.");

  if (body == null) {
    throw AssertionError("Response body is null");
  }

  if (body!.isRight) {
    throw AssertionError("Expected array, got single object");
  }

  return body!.left;
}