Struct afire::extension::Trace

source ยท
pub struct Trace { /* private fields */ }
Expand description

Adds support for the HTTP TRACE method. It echos the request (Status line + Headers) back to the client as the response body. The Cookie header is excluded by default because it could contain sensitive information. Read more about it in RFC-9110.

Implementationsยง

sourceยง

impl Trace

source

pub fn new() -> Self

Create a new instance of the middleware. Note: The Cookie header is excluded by default because it could contain sensitive information. If you want to include it, use the include method.

source

pub fn exclude(self, header: HeaderType) -> Self

Adds a header to the list of headers to exclude from the response.

source

pub fn exclude_all(self, headers: &[HeaderType]) -> Self

Adds a list of headers to the list of headers to exclude from the response.

source

pub fn include(self, header: HeaderType) -> Self

Removes a header from the list of headers to exclude from the response. Likely to be used with for allowing the Cookie header to be sent, as it is excluded by default.

Trait Implementationsยง

sourceยง

impl Default for Trace

sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
sourceยง

impl Middleware for Trace

sourceยง

fn pre(&self, req: &mut Request) -> MiddleResult

Middleware to run Before Routes
sourceยง

fn pre_raw(&self, req: &mut Result<Request>) -> MiddleResult

Middleware to run before routes. Because this is the raw version of Middleware::pre, it is passed a Result. The default implementation calls Middleware::pre if the Result is Ok.
sourceยง

fn post_raw( &self, req: Result<Rc<Request>>, res: &mut Result<Response> ) -> MiddleResult

Middleware to run after routes. Because this is the raw version of Middleware::post, it is passed a Result. The default implementation calls Middleware::post if the Result is Ok.
sourceยง

fn post(&self, _req: &Request, _res: &mut Response) -> MiddleResult

Middleware to run After Routes
sourceยง

fn end_raw(&self, req: &Result<Request>, res: &Result<Response>)

Middleware to run after the response has been handled. Because this is the raw version of Middleware::end, it is passed a Result. The default implementation calls Middleware::end if the Result is Ok.
sourceยง

fn end(&self, _req: &Request, _res: &Response)

Middleware ot run after the response has been handled
sourceยง

fn attach<State>(self, server: &mut Server<State>)where Self: 'static + Send + Sync + Sized, State: 'static + Send + Sync,

Attach Middleware to a Server. If you want to get a reference to the serverโ€™s state in your middleware state, you should override this method.

Auto Trait Implementationsยง

Blanket Implementationsยง

sourceยง

impl<T> Any for Twhere T: 'static + ?Sized,

sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
sourceยง

impl<T> Borrow<T> for Twhere T: ?Sized,

sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
sourceยง

impl<T> BorrowMut<T> for Twhere T: ?Sized,

sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
sourceยง

impl<T> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

sourceยง

impl<T, U> Into<U> for Twhere U: From<T>,

sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

sourceยง

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

ยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

ยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.