interceptWithAlice method

Future<Response> interceptWithAlice(
  1. AliceHttpAdapter adapter, {
  2. dynamic body,
})

Intercept http request with alice. This extension method provides additional helpful method to intercept https' response.

Implementation

Future<Response> interceptWithAlice(
  AliceHttpAdapter adapter, {
  dynamic body,
}) async {
  final startTime = DateTime.now();
  final response = await this;
  final endTime = DateTime.now();
  adapter.onResponse(
    response,
    body: body,
    duration: endTime.difference(startTime),
  );
  return response;
}