recordHttp static method

void recordHttp(
  1. HttpRequestRecord r
)

Buffer r with its credentials masked by TelescopeRedaction, and emit the masked copy on onHttpRecord. Never throws on a malformed body: one that is not JSON is buffered as given. When a TelescopeRedaction.redactor is registered it runs after the key masking, before the record enters the queue or the stream; a record the redactor throws on is dropped, neither buffered nor emitted.

Implementation

static void recordHttp(HttpRequestRecord r) {
  if (_paused) return;
  final HttpRequestRecord? redacted = TelescopeRedaction.redactHttpRecord(r);
  if (redacted == null) return;
  _http.addLast(redacted);
  while (_http.length > _capacityOf(TelescopeKind.http)) {
    _http.removeFirst();
  }
  _httpStream.add(redacted);
}