pub struct Response {
pub data: Option<Vec<u8>>,
/* private fields */
}Expand description
An HTTP response.
Fields§
§data: Option<Vec<u8>>The stored request response data.
Implementations§
Source§impl Response
impl Response
Sourcepub fn status_code(&self) -> i32
pub fn status_code(&self) -> i32
Get the response’s status code.
Sourcepub fn get_header<T: AsRef<str>>(&self, header: T) -> Option<String>
pub fn get_header<T: AsRef<str>>(&self, header: T) -> Option<String>
Get a response HTTP header.
Sourcepub fn get_image(&self) -> Result<ImageRef, RequestError>
pub fn get_image(&self) -> Result<ImageRef, RequestError>
Gets the response data as an image.
Sourcepub fn get_string(&self) -> Result<String, AidokuError>
pub fn get_string(&self) -> Result<String, AidokuError>
Gets the response data as a string.
Sourcepub fn get_html(&self) -> Result<Document, RequestError>
pub fn get_html(&self) -> Result<Document, RequestError>
Get the response data as an HTML Document.
Sourcepub fn into_request(self) -> Request
pub fn into_request(self) -> Request
Create a new request with the same method and url as the one sent to get this response.
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