pub struct HttpModuleCtx { /* private fields */ }
Expand description
The Contexts of multiple modules
This is the object that will apply all the included modules to a certain HTTP request.
The modules are ordered according to their order()
.
Implementations§
Source§impl HttpModuleCtx
impl HttpModuleCtx
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create a placeholder empty HttpModuleCtx.
HttpModules should be used to create nonempty HttpModuleCtx.
Sourcepub fn get<T: 'static>(&self) -> Option<&T>
pub fn get<T: 'static>(&self) -> Option<&T>
Get a ref to HttpModule if any.
Sourcepub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>
pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T>
Get a mut ref to HttpModule if any.
Sourcepub async fn request_header_filter(
&mut self,
req: &mut RequestHeader,
) -> Result<()>
pub async fn request_header_filter( &mut self, req: &mut RequestHeader, ) -> Result<()>
Run the request_header_filter
for all the modules according to their orders.
Sourcepub async fn request_body_filter(
&mut self,
body: &mut Option<Bytes>,
end_of_stream: bool,
) -> Result<()>
pub async fn request_body_filter( &mut self, body: &mut Option<Bytes>, end_of_stream: bool, ) -> Result<()>
Run the request_body_filter
for all the modules according to their orders.
Sourcepub async fn response_header_filter(
&mut self,
req: &mut ResponseHeader,
end_of_stream: bool,
) -> Result<()>
pub async fn response_header_filter( &mut self, req: &mut ResponseHeader, end_of_stream: bool, ) -> Result<()>
Run the response_header_filter
for all the modules according to their orders.
Sourcepub fn response_body_filter(
&mut self,
body: &mut Option<Bytes>,
end_of_stream: bool,
) -> Result<()>
pub fn response_body_filter( &mut self, body: &mut Option<Bytes>, end_of_stream: bool, ) -> Result<()>
Run the response_body_filter
for all the modules according to their orders.
Sourcepub fn response_trailer_filter(
&mut self,
trailers: &mut Option<Box<HeaderMap>>,
) -> Result<Option<Bytes>>
pub fn response_trailer_filter( &mut self, trailers: &mut Option<Box<HeaderMap>>, ) -> Result<Option<Bytes>>
Run the response_trailer_filter
for all the modules according to their orders.
Returns an Option<Bytes>
which can be used to write response trailers into
the response body. Note, if multiple modules attempt to write trailers into
the body the last one will be used.
Implementors that intend to write trailers into the body need to ensure their filter is using an encoding that supports this.