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 safeValue = values
.map((value) => redact ? _redactor.headerValue(name, value) : value)
.join(', ');
final boundedValue = safeValue.length > maxHeaderValueLength
? '${safeValue.substring(0, maxHeaderValueLength)}...'
: safeValue;
captured[name] = boundedValue;
});
return Map<String, String>.unmodifiable(captured);
}