onRequest method
Implementation
void onRequest(HttpClientRequest request, {dynamic requestBody}) {
final requestHeaders = <String, dynamic>{};
request.headers.forEach((String header, dynamic value) {
requestHeaders[header] = value[0];
});
final NetworkData requestData = NetworkData(
startTime: DateTime.now(),
method: request.method,
url: request.uri.toString(),
requestHeaders: requestHeaders,
requestBody: requestBody ?? '',
requestBodySize: int.parse(requestHeaders['content-length'] ?? '0'),
);
requests[request.hashCode] = requestData;
}