Struct edjx::FetchResponse [−][src]
pub struct FetchResponse { /* fields omitted */ }
Expand description
Response for HTTP fetch request, which may include body, headers, and status code.
use edjx::{FetchResponse, HttpFetch};
use http::StatusCode;
let fetch_uri = Uri::from_str("https://httpbin.org/get").unwrap();
let mut fetch_res: FetchResponse = match HttpFetch::get(fetch_uri).send() {
Ok(resp) => resp,
Err(e) => {
panic!("{}", &e.to_string());
}
};
let body = fetch_res.body();
assert_eq!(fetch_res.status_code(), &StatusCode::OK);
Implementations
Returns the HTTP status code of the fetch response.