onRequest method

void onRequest(
  1. HttpClientRequest request, {
  2. String? requestBody,
})

Implementation

void onRequest(
  HttpClientRequest request, {
  String? requestBody,
}) {
  final NetworkRequest networkRequest = NetworkRequest();
  networkRequest.startTime = DateTime.now();
  networkRequest.method = request.method;
  networkRequest.url = request.uri.toString();
  networkRequest.requestBody = _removeBinaryData(requestBody);
  request.headers.forEach((String header, dynamic value) {
    networkRequest.requestHeaders[header] = value[0].toString();
  });

  _requests[request.hashCode] = networkRequest;
}