fetch_url

Function fetch_url 

Source
pub async fn fetch_url<T: Serialize>(
    url: &str,
    headers: &[(&str, &str)],
    method: Option<Method>,
    body: Option<&T>,
) -> Result<Vec<u8>, NetError>
Available on crate feature std only.
Expand description

STD fetch with arbitrary HTTP method and optional JSON body Example:

fetch_url("http://example.com/api", &[("header","value")], Some(Method::Post), Some(&my_struct)).await