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
impl Trace
sourcepub fn new() -> Self
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.
sourcepub fn exclude(self, header: HeaderType) -> Self
pub fn exclude(self, header: HeaderType) -> Self
Adds a header to the list of headers to exclude from the response.
sourcepub fn exclude_all(self, headers: &[HeaderType]) -> Self
pub fn exclude_all(self, headers: &[HeaderType]) -> Self
Adds a list of headers to the list of headers to exclude from the response.
sourcepub fn include(self, header: HeaderType) -> Self
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 Middleware for Trace
impl Middleware for Trace
sourceยงfn pre(&self, req: &mut Request) -> MiddleResult
fn pre(&self, req: &mut Request) -> MiddleResult
Middleware to run Before Routes
sourceยงfn pre_raw(&self, req: &mut Result<Request>) -> MiddleResult
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
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
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>)
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
.Auto Trait Implementationsยง
impl RefUnwindSafe for Trace
impl Send for Trace
impl Sync for Trace
impl Unpin for Trace
impl UnwindSafe for Trace
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