pub struct HttpResponse<IO: AsyncRead + AsyncWrite + Unpin = TcpOrTlsStream> { /* private fields */ }
Implementations§
Source§impl<IO: AsyncRead + AsyncWrite + Unpin> HttpResponse<IO>
impl<IO: AsyncRead + AsyncWrite + Unpin> HttpResponse<IO>
Sourcepub fn request_headers(&self) -> &HeaderMap
pub fn request_headers(&self) -> &HeaderMap
Access the original requests headers as http::HeaderMap.
Sourcepub fn method(&self) -> Method
pub fn method(&self) -> Method
Return the original requests method as http::Method.
Sourcepub fn version(&self) -> Version
pub fn version(&self) -> Version
Return the HTTP version as http::Version.
Sourcepub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
Access the currently set response headers as http::HeaderMap.
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Access the currently set response headers as mutable http::HeaderMap.
Sourcepub fn insert_header(
&mut self,
key: impl IntoHeaderName,
value: HeaderValue,
) -> &mut Self
pub fn insert_header( &mut self, key: impl IntoHeaderName, value: HeaderValue, ) -> &mut Self
Insert a response header (chainable).
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Access the currently set response status as http::StatusCode.
Sourcepub fn status_mut(&mut self) -> &mut StatusCode
pub fn status_mut(&mut self) -> &mut StatusCode
Access the currently set response status as mutable http::StatusCode.
Sourcepub fn set_status(&mut self, status: StatusCode) -> &mut Self
pub fn set_status(&mut self, status: StatusCode) -> &mut Self
Set the response status (chainable).
Sourcepub async fn send(self, body: impl AsRef<[u8]>) -> Result<()>
pub async fn send(self, body: impl AsRef<[u8]>) -> Result<()>
Send the request with the specified body. See Self::body for sending a response with a streaming body.
Sourcepub async fn body(self) -> Result<BodyEncode<IO>>
pub async fn body(self) -> Result<BodyEncode<IO>>
Move on to sending body after sending response head.
Trait Implementations§
Auto Trait Implementations§
impl<IO = TcpOrTlsStream> !Freeze for HttpResponse<IO>
impl<IO> RefUnwindSafe for HttpResponse<IO>where
IO: RefUnwindSafe,
impl<IO> Send for HttpResponse<IO>where
IO: Send,
impl<IO> Sync for HttpResponse<IO>where
IO: Sync,
impl<IO> Unpin for HttpResponse<IO>
impl<IO> UnwindSafe for HttpResponse<IO>where
IO: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
Source§impl<'a, T> AsTaggedImplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for Twhere
T: 'a,
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