getMockClientHandler static method
Future<Response>
getMockClientHandler(
- Request request
)
Implementation
static Future<Response> getMockClientHandler(Request request) async {
TGMockMappingVO? mockMappingVO =
TGMockService.getMockMappingVO(request.url.toString(), request.method);
if (mockMappingVO != null) {
await new Future.delayed(const Duration(seconds: 1));
String responseString =
(mockMappingVO.httpStatus! >= 200 && mockMappingVO.httpStatus! <= 299)
? mockMappingVO.successString
: mockMappingVO.errorString;
return new Response(responseString, mockMappingVO.httpStatus!);
} else {
throw Exception(
"ERROR: Unable to find MockMapping for " + request.url.toString());
}
}