pub struct BodyLimitsConfig {
pub max_request_bytes: Option<usize>,
pub max_response_bytes: Option<usize>,
}Expand description
Global hard ceilings on request and response body size.
Both limits default to 10 MiB. Setting either to null
in YAML removes the ceiling, but Praxis will refuse to
start unless insecure_options.allow_unbounded_body is
also true.
use praxis_core::config::{BodyLimitsConfig, DEFAULT_MAX_BODY_BYTES};
let limits = BodyLimitsConfig::default();
assert_eq!(limits.max_request_bytes, Some(DEFAULT_MAX_BODY_BYTES));
assert_eq!(limits.max_response_bytes, Some(DEFAULT_MAX_BODY_BYTES));use praxis_core::config::BodyLimitsConfig;
let limits: BodyLimitsConfig = serde_yaml::from_str(
r#"
max_request_bytes: 5242880
max_response_bytes: 2097152
"#,
)
.unwrap();
assert_eq!(limits.max_request_bytes, Some(5_242_880));
assert_eq!(limits.max_response_bytes, Some(2_097_152));Fields§
§max_request_bytes: Option<usize>Maximum request body size in bytes.
Defaults to 10 MiB. None (YAML null) disables the
limit and requires insecure_options.allow_unbounded_body.
max_response_bytes: Option<usize>Maximum response body size in bytes.
Defaults to 10 MiB. None (YAML null) disables the
limit and requires insecure_options.allow_unbounded_body.
Trait Implementations§
Source§impl Clone for BodyLimitsConfig
impl Clone for BodyLimitsConfig
Source§fn clone(&self) -> BodyLimitsConfig
fn clone(&self) -> BodyLimitsConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BodyLimitsConfig
impl Debug for BodyLimitsConfig
Source§impl Default for BodyLimitsConfig
impl Default for BodyLimitsConfig
Source§impl<'de> Deserialize<'de> for BodyLimitsConfigwhere
BodyLimitsConfig: Default,
impl<'de> Deserialize<'de> for BodyLimitsConfigwhere
BodyLimitsConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BodyLimitsConfig
impl RefUnwindSafe for BodyLimitsConfig
impl Send for BodyLimitsConfig
impl Sync for BodyLimitsConfig
impl Unpin for BodyLimitsConfig
impl UnsafeUnpin for BodyLimitsConfig
impl UnwindSafe for BodyLimitsConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more