reply method

void reply(
  1. AgEndpoint endpoint, {
  2. AgHttpMethod method = AgHttpMethod.get,
  3. Object? json,
  4. int statusCode = 200,
  5. Map<String, List<String>> headers = const {},
})

Answers method requests to endpoint with json, decoded by the caller's decode exactly as a real response body would be. A statusCode outside 2xx throws an AgApiException carrying json as its responseBody, as the real provider does.

Implementation

void reply(
  AgEndpoint endpoint, {
  AgHttpMethod method = AgHttpMethod.get,
  Object? json,
  int statusCode = 200,
  Map<String, List<String>> headers = const {},
}) {
  replyWith(
    endpoint,
    (_) => json,
    method: method,
    statusCode: statusCode,
    headers: headers,
  );
}