stallRecordOfRequest function

StallRequestRecord stallRecordOfRequest(
  1. BaseRequest request
)

Captures the outbound identity + payload of request (the sentinel's evidence record; also used by the registry). Gated by stallSentinelEnabled: with the sentinel opted out the body is NOT held (no Expando retention of the payload) — metadata only.

Implementation

StallRequestRecord stallRecordOfRequest(http.BaseRequest request) {
  Uint8List? body;
  if (stallSentinelEnabled && request is http.Request) {
    try {
      body = request.bodyBytes;
    } on Object {
      body =
          null; // a finalized/streamed body we cannot re-read — dump metadata only.
    }
  }
  return StallRequestRecord._(
    method: request.method,
    url: request.url,
    headers: Map.of(request.headers),
    bodyBytes: body,
    sentAt: DateTime.now(),
  );
}