Struct ark_api::http_request::Response
source · pub struct Response {
pub status_code: u16,
/* private fields */
}Expand description
HTTP response object sent back from a server.
Fields§
§status_code: u16HTTP status code.
If it’s different from the 200 range (from 200 to 299), indicates a failure that needs to be handled.
Implementations§
source§impl Response
impl Response
sourcepub fn into_bytes(self) -> Vec<u8>
pub fn into_bytes(self) -> Vec<u8>
Consumes the Response object into the bytes it contains.
sourcepub fn as_text(&self) -> Result<String, FromUtf8Error>
pub fn as_text(&self) -> Result<String, FromUtf8Error>
Bytes sent back from the server, interpreted as a string. Can fail if the bytes don’t represent a valid utf8 encoding.
sourcepub fn as_text_lossy(&self) -> Cow<'_, str>
pub fn as_text_lossy(&self) -> Cow<'_, str>
Bytes sent back from the server, interpreted as a string. Will interpret invalid utf8 encodings loosely, so as to return something.