snapshotHeaders method
Implementation
Map<String, String> snapshotHeaders(HttpHeaders headers) {
if (!captureHeaders) {
return const <String, String>{};
}
final captured = <String, String>{};
headers.forEach((name, values) {
if (captured.length >= maxHeaderCount) {
return;
}
final rawValue = values.join(', ');
final boundedValue = rawValue.length > maxHeaderValueLength
? '${rawValue.substring(0, maxHeaderValueLength)}...'
: rawValue;
captured[name] = boundedValue;
});
return Map<String, String>.unmodifiable(captured);
}