pub struct Response {
pub status: u16,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
pub attempts: u32,
/* private fields */
}Fields§
§status: u16§headers: Vec<(String, String)>Lower-cased header names.
body: Vec<u8>§attempts: u32Implementations§
Source§impl Response
impl Response
pub fn header(&self, name: &str) -> Option<&str>
Sourcepub fn header_all<'a>(
&'a self,
name: &str,
) -> impl Iterator<Item = &'a str> + 'a
pub fn header_all<'a>( &'a self, name: &str, ) -> impl Iterator<Item = &'a str> + 'a
Every value of a repeated header, in order (for example several Set-Cookie lines).
Response::header returns only the first.
Sourcepub fn final_url(&self) -> &str
pub fn final_url(&self) -> &str
The URL after the followed redirects, as the caller’s own URL data (it keeps any query
string; Debug redacts it).
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
The numeric or HTTP-date Retry-After delay, when the response carries one.
pub fn text(&self) -> String
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T, HttpError>
pub fn json<T: DeserializeOwned>(&self) -> Result<T, HttpError>
Decode the body. The error names the failure category and position only: serde’s own text can echo fragments of the body, which may be secret.
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 UnsafeUnpin 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