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 `Content-Type` header could not be interpreted safely.
16    InvalidContentType,
17    /// A complete JSON body was invalid.
18    InvalidJson,
19    /// A JSON capture was invalid or truncated.
20    InvalidOrTruncatedJson,
21    /// A complete newline-delimited JSON body was invalid.
22    InvalidNdjson,
23    /// A newline-delimited JSON capture was invalid or truncated.
24    InvalidOrTruncatedNdjson,
25    /// A complete URL-encoded form body was invalid.
26    InvalidFormUrlEncoded,
27    /// A URL-encoded form capture was invalid or truncated.
28    InvalidOrTruncatedFormUrlEncoded,
29    /// A complete multipart body was malformed or ambiguous.
30    InvalidMultipart,
31    /// A multipart capture was truncated and could not be parsed safely.
32    TruncatedMultipart,
33    /// A UTF-8 body used an unsupported media type.
34    UnsupportedMediaType,
35    /// An opaque text body was hidden by policy.
36    OpaqueText,
37}