onResponse method

void onResponse(
  1. HttpClientRequest request,
  2. HttpClientResponse response, {
  3. String? responseBody,
})

Implementation

void onResponse(
  HttpClientRequest request,
  HttpClientResponse response, {
  String? responseBody,
}) async {
  final NetworkRequest? networkRequest = _getRequestData(request.hashCode);
  if (networkRequest == null) {
    return null;
  }

  networkRequest.endTime = DateTime.now();
  networkRequest.duration = _findDuration(networkRequest);
  networkRequest.status = response.statusCode.toString();
  networkRequest.responseBody = _removeBinaryData(responseBody);
  response.headers.forEach((String header, dynamic value) {
    networkRequest.responseHeaders[header] = value[0].toString();
  });

  Shake.insertNetworkRequest(networkRequest);
}