Skip to main content

RefusalResponse

Trait RefusalResponse 

Source
pub trait RefusalResponse<B>: Sealed<B> {
    // Required method
    fn refusal_response(&self, cx: RejectContext<'_>) -> Response<B>;
}
Available on crate feature tower only.
Expand description

Builds the response for a refusal (its body and any extra headers); see HttpAuthLayerBuilder::on_reject. Implemented for EmptyRefusal (the default) and for every Fn(RejectContext<'_>) -> http::Response<B>.

Sealed: it can be named in bounds, but not implemented outside this crate, since only HttpAuthLayerBuilder::on_reject (which takes a closure) can install a refusal builder.

Required Methods§

Source

fn refusal_response(&self, cx: RejectContext<'_>) -> Response<B>

The response for this refusal, before the layer sets its status and WWW-Authenticate challenge.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<B, F> RefusalResponse<B> for F
where F: Fn(RejectContext<'_>) -> Response<B>,

Source§

impl<B: Default> RefusalResponse<B> for EmptyRefusal