onHandle method

  1. @override
Future<Response> onHandle(
  1. Request request
)

Method called when something should be handled in this class

Implementation

@override
Future<Response> onHandle(Request request) async {
  var endpointChain = this[request.method];
  if (endpointChain == null) {
    return Response(
      request: request,
      statusCode: 404,
      headers: {},
      contentType: ContentType.json,
      body: '{"message":"The method does not exists"}',
    );
  }
  return endpointChain.onHandle(request);
}