on method

void on(
  1. String method,
  2. Pattern path,
  3. MockHandler handler
)

Answers matching requests with the result of handler.

Registering the same method and path again prepends the new route, so the latest registration wins.

Implementation

void on(String method, Pattern path, MockHandler handler) {
  _routes.insert(0, _Route(method.toUpperCase(), path, handler));
}