Skip to main content

ResponseForProtectionError

Trait ResponseForProtectionError 

pub trait ResponseForProtectionError<B>:
    Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn response_for_protection_error(
        &self,
        error: ProtectionError,
    ) -> Response<B>;
}
Available on crate feature http only.
Expand description

Builds the response returned by Csrf when a request fails CSRF protection.

Implemented for any Fn(ProtectionError) -> Response<B> + Clone + Send + Sync + 'static, so a closure can be passed directly to CsrfLayer::with_rejection_response.

Required Methods§

fn response_for_protection_error(&self, error: ProtectionError) -> Response<B>

Builds the response from the rejection error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§