qubit_redact/formats/http/url_path_policy.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//! Policy for rendering URL paths in HTTP diagnostics.
9
10/// Controls whether complete URL paths remain visible after redaction.
11///
12/// This policy does not affect URL userinfo, fragments, or recognized
13/// sensitive query values. The standard policy preserves paths for diagnostic
14/// usefulness; strict policies should select [`Self::Redact`] when paths may
15/// contain opaque identifiers or credentials.
16///
17/// # Examples
18///
19/// ```
20/// use qubit_redact::formats::http::UrlPathPolicy;
21///
22/// assert_eq!(UrlPathPolicy::default(), UrlPathPolicy::Preserve);
23/// ```
24#[non_exhaustive]
25#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
26pub enum UrlPathPolicy {
27 /// Preserves the complete URL path.
28 #[default]
29 Preserve,
30 /// Replaces a non-root URL path with a fixed redaction marker.
31 Redact,
32}