pub struct RequestGuardBuilder { /* private fields */ }Expand description
Builder for RequestGuard.
Implementations§
Source§impl RequestGuardBuilder
impl RequestGuardBuilder
Sourcepub fn max_body_size(self, size: u64) -> Self
pub fn max_body_size(self, size: u64) -> Self
Set the maximum allowed body size in bytes.
Sourcepub fn allowed_content_types<I, S>(self, types: I) -> Self
pub fn allowed_content_types<I, S>(self, types: I) -> Self
Set the allowed Content-Type media types (e.g. "application/json").
Sourcepub fn require_header(self, name: impl Into<String>) -> Self
pub fn require_header(self, name: impl Into<String>) -> Self
Require a header to be present on every request.
Sourcepub fn on_violation(self, policy: OnViolation) -> Self
pub fn on_violation(self, policy: OnViolation) -> Self
Set the violation handling policy (default: OnViolation::Reject).
Sourcepub fn build(self) -> RequestGuard
pub fn build(self) -> RequestGuard
Build the RequestGuard with the configured settings.
Trait Implementations§
Source§impl Default for RequestGuardBuilder
impl Default for RequestGuardBuilder
Source§fn default() -> RequestGuardBuilder
fn default() -> RequestGuardBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RequestGuardBuilder
impl !RefUnwindSafe for RequestGuardBuilder
impl Send for RequestGuardBuilder
impl Sync for RequestGuardBuilder
impl Unpin for RequestGuardBuilder
impl UnsafeUnpin for RequestGuardBuilder
impl !UnwindSafe for RequestGuardBuilder
Blanket Implementations§
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