onResponse method

  1. @override
void onResponse(
  1. Response response,
  2. ResponseInterceptorHandler handler
)

Called when the response is about to be resolved.

Implementation

@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
  _printResponseHeader(response);
  if (responseHeader) {
    final responseHeaders = <String, String>{};
    response.headers
        .forEach((k, list) => responseHeaders[k] = list.toString());
    _printMapAsTable(responseHeaders, header: 'Headers');
  }

  if (responseBody) {
    logPrint('╔ Body');
    logPrint('║');
    _printResponse(response);
    logPrint('║');
    _printLine('╚');
  }
  super.onResponse(response, handler);
}