Function ureq::request_url

source ·
pub fn request_url(method: &str, url: &Url) -> Request
Expand description

Make a request using an already-parsed Url.

This is useful if you’ve got a parsed Url from some other source, or if you want to parse the URL and then modify it before making the request. If you’d just like to pass a String or a &str, try request().

use url::Url;
let agent = ureq::agent();

let mut url: Url = "http://example.com/some-page".parse()?;
url.set_path("/get/robots.txt");
let resp: ureq::Response = ureq::request_url("GET", &url)
    .call()?;