Skip to main content

PreBodyValidator

Trait PreBodyValidator 

Source
pub trait PreBodyValidator: Send + Sync {
    // Required method
    fn validate(&self, request: &Request) -> Result<(), Response>;

    // Provided method
    fn name(&self) -> &'static str { ... }
}
Expand description

Trait for pre-body validation hooks.

Implement this trait to add custom validation that runs before sending 100 Continue and reading the request body.

Required Methods§

Source

fn validate(&self, request: &Request) -> Result<(), Response>

Validate the request headers before body is read.

Returns Ok(()) if validation passes, or Err(Response) with an appropriate error response if validation fails.

Provided Methods§

Source

fn name(&self) -> &'static str

Optional name for debugging/logging.

Implementors§