Skip to main content

fetch

Function fetch 

Source
pub fn fetch(
    method: &str,
    url: &str,
    headers: &[(&str, &str)],
    body: Option<&str>,
) -> Option<FetchResponse>
Expand description

Make an HTTP request.

let resp = http::fetch("GET", "https://api.example.com/data", &[], None);
if let Some(resp) = resp {
    if resp.is_success() {
        log::info(&format!("Got: {}", resp.body));
    }
}