pub struct Response<B> { /* private fields */ }
Expand description
An HTTP response.
Implementations
Constructs a new response with default body.
Constructs a new response builder.
Constructs a new response with status 400 Bad Request.
Constructs a new response with status 500 Internal Server Error.
Constructs a new response with given body.
Returns a reference to the head of this response.
Returns a mutable reference to the head of this response.
Returns the status code of this response.
Returns a mutable reference the status code of this response.
Returns a mutable reference to response headers.
Returns true if keep-alive is enabled.
Returns a reference to the request-local data/extensions container.
Returns a mutable reference to the request-local data/extensions container.
Returns split head and body.
Implementation Notes
Due to internal performance optimizations, the first element of the returned tuple is a
Response
as well but only contains the head of the response this was called on.
pub fn map_body<F, B2>(self, f: F) -> Response<B2> where
F: FnOnce(&mut ResponseHead, B) -> B2,
pub fn map_body<F, B2>(self, f: F) -> Response<B2> where
F: FnOnce(&mut ResponseHead, B) -> B2,
Map the current body type to another using a closure. Returns a new response.
Closure receives the response head and the current body type.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody> type Output = Result<Response<BoxBody>, Error>;
fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody> type Output = Result<Response<BoxBody>, Error>;
impl Future for HttpResponse<BoxBody> type Output = Result<Response<BoxBody>, Error>;
Convert self to HttpResponse
.
Wraps responder to allow alteration of its response. Read more
Auto Trait Implementations
impl<B> !RefUnwindSafe for Response<B>
impl<B> !UnwindSafe for Response<B>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more