reqwest

Function get

Source
pub async fn get<T: IntoUrl>(url: T) -> Result<Response>
Expand description

Shortcut method to quickly make a GET request.

See also the methods on the reqwest::Response type.

NOTE: This function creates a new internal Client on each call, and so should not be used if making many requests. Create a Client instead.

§Examples

let body = reqwest::get("https://www.rust-lang.org").await?
    .text().await?;

§Errors

This function fails if:

  • native TLS backend cannot be initialized
  • supplied Url cannot be parsed
  • there was an error while sending request
  • redirect limit was exhausted