when method

MockResponseBuilder when(
  1. HttpMethod method,
  2. String path
)

Starts preparing the answer to method requests for path; finish it with one of the methods of the returned MockResponseBuilder.

path is a path (/books/1, any host matches) or a full URL (https://api.neon.books/books/1, scheme, host and port must match). A trailing / does not matter. Without a ? any query matches; with one (/books?q=dune) the query must have exactly the same parameters and values.

Implementation

MockResponseBuilder when(HttpMethod method, String path) {
  final expectation = _Expectation(method, path);
  _expectations.add(expectation);
  return MockResponseBuilder._(expectation);
}