whenGet method

void whenGet(
  1. String pathOrTemplate,
  2. CharlatanResponseBuilder responseBuilder
)

Adds a fake response definition for a GET request to the provided pathOrTemplate. If the response is not a CharlatanHttpResponse then the statusCode will be used.

Implementation

void whenGet(
  String pathOrTemplate,
  CharlatanResponseBuilder responseBuilder,
) {
  _matchers.insert(
    0,
    CharlatanResponseDefinition(
      description: 'GET $pathOrTemplate',
      requestMatcher: requestMatchesAll([
        requestMatchesHttpMethod('get'),
        requestMatchesPathOrTemplate(pathOrTemplate),
      ]),
      responseBuilder: responseBuilder,
    ),
  );
}