pub struct Response { /* private fields */ }
Expand description
Represents an HTTP response.
Implementations
Creates a new Response
with the given head and body.
Creates a response builder.
Returns the associated status code.
Returns true
if status code is StatusCode::OK
.
Check if status is within 200-299.
Sets the status code for this response.
Returns the content type of this response.
Returns a mutable reference to the associated header map.
Returns the string value of the specified header.
NOTE: Returns None
if the header value is not a valid UTF8 string.
Sets the version for this response.
Returns a reference to the associated extensions.
Returns a mutable reference to the associated extensions.
Get a reference from extensions, similar to self.extensions().get()
.
Inserts a value to extensions, similar to
self.extensions().insert(data)
.
Take the body from this response and sets the body to empty.
Consumes the response returning the head and body parts.
Trait Implementations
Performs the conversion.
Performs the conversion.
Consume itself and return Response
.
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self> where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
Self: Sized,
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self> where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
Self: Sized,
Wrap an impl IntoResponse
to add a header. Read more
Wrap an impl IntoResponse
to set a status code. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Response
impl !UnwindSafe for Response
Blanket Implementations
Mutably borrows from an owned value. Read more
Consumes this value returns a poem::Result<T>
.
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