pub struct HttpContext { /* private fields */ }Expand description
Concrete implementation of IHttpContext wrapping a hyper request and response.
The request body is eagerly read during construction so that the IHttpRequest trait can provide sync access to body bytes.
Implementations§
Source§impl HttpContext
impl HttpContext
Sourcepub async fn new(req: Request<Incoming>, max_body_size: usize) -> HttpContext
pub async fn new(req: Request<Incoming>, max_body_size: usize) -> HttpContext
Create a new HttpContext by eagerly reading the request body.
Reads the body in chunks using [BodyExt::frame], tracking total size.
When max_body_size is exceeded, the context is built with a 413
Payload Too Large response pre-set.
pub fn into_response(self) -> Response<Full<Bytes>>
Trait Implementations§
Source§impl IClaimsExt for HttpContext
impl IClaimsExt for HttpContext
Source§impl IHttpContext for HttpContext
impl IHttpContext for HttpContext
fn request(&self) -> &dyn IHttpRequest
fn request_mut(&mut self) -> &mut dyn IHttpRequest
fn response(&self) -> &dyn IHttpResponse
fn response_mut(&mut self) -> &mut dyn IHttpResponse
Auto Trait Implementations§
impl !RefUnwindSafe for HttpContext
impl !UnwindSafe for HttpContext
impl Freeze for HttpContext
impl Send for HttpContext
impl Sync for HttpContext
impl Unpin for HttpContext
impl UnsafeUnpin for HttpContext
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