Skip to main content

qubit_redact/http/
body_redaction_reason.rs

1// =============================================================================
2//    Copyright (c) 2025 - 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Fail-closed reasons for an HTTP body redaction.
9
10/// Identifies why an HTTP body could not be represented structurally.
11#[must_use]
12#[non_exhaustive]
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum BodyRedactionReason {
15    /// The shared diagnostic session could not inspect or emit this body.
16    DiagnosticBudgetExceeded,
17    /// The `Content-Type` header could not be interpreted safely.
18    InvalidContentType,
19    /// A complete JSON body was invalid.
20    InvalidJson,
21    /// A JSON capture was invalid or truncated.
22    InvalidOrTruncatedJson,
23    /// A complete newline-delimited JSON body was invalid.
24    InvalidNdjson,
25    /// A newline-delimited JSON capture was invalid or truncated.
26    InvalidOrTruncatedNdjson,
27    /// A complete URL-encoded form body was invalid.
28    InvalidFormUrlEncoded,
29    /// A URL-encoded form capture was invalid or truncated.
30    InvalidOrTruncatedFormUrlEncoded,
31    /// A complete multipart body was malformed or ambiguous.
32    InvalidMultipart,
33    /// A multipart capture was truncated and could not be parsed safely.
34    TruncatedMultipart,
35    /// A UTF-8 body used an unsupported media type.
36    UnsupportedMediaType,
37    /// An opaque text body was hidden by policy.
38    OpaqueText,
39}