Struct generic_async_http_client::Response
source · pub struct Response(/* private fields */);
Expand description
The response of a webserver. Headers and Status are available from the start, the body must be polled/awaited again
Depending on the chosen implementation, Response
implements Into<http_types::Response>
or Into<hyper::Response>
.
Implementations§
source§impl Response
impl Response
sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Return the status code
sourcepub async fn json<D: DeserializeOwned>(&mut self) -> Result<D, Error>
pub async fn json<D: DeserializeOwned>(&mut self) -> Result<D, Error>
Return the Body as some type deserialized from JSON
sourcepub fn header(
&self,
name: impl TryInto<HeaderName, Error = Error>
) -> Option<&HeaderValue>
pub fn header( &self, name: impl TryInto<HeaderName, Error = Error> ) -> Option<&HeaderValue>
If there are multiple values associated with the key, then the first one is returned.
sourcepub fn headers(&self) -> impl Iterator<Item = (&HeaderName, &HeaderValue)>
pub fn headers(&self) -> impl Iterator<Item = (&HeaderName, &HeaderValue)>
Each key will be yielded once per associated value. So, if a key has 3 associated values, it will be yielded 3 times.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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