doGetTestData static method

Future<FastHttpResponse> doGetTestData(
  1. FastRequest request,
  2. dynamic body,
  3. Map<String, String> headers
)

Implementation

static Future<FastHttpResponse> doGetTestData(FastRequest request, body,
    Map<String, String> headers) async {
  late FastHttpResponse httpResponse;

  String data = await loadAsset(request.localTestData()!);

  try {
//      String methodKey = request.url().replaceAll('/', '_');
    String methodKey = request.url();

    Map<String, dynamic> result = jsonDecode(data);

    httpResponse =
        FastHttpResponse(jsonEncode(result[methodKey]), 200, {}, result);
  } catch (e) {
    print('doGetTestData error : ${e.toString()}');
  }

  return httpResponse;
}