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.

Returns the HTTP header map of the fetch response.

Returns the HTTP body of the fetch response.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.