Can't find method even though feature is in dependencies (reqwest)

    let client = reqwest::blocking::Client::new();
    let res = my_res!("https://removed")
        .body("the exact body that is sent")
        .send(), {
            return Err(String::from("failed send"));

is producing compiler error: no method named danger_accept_invalid_certs found for struct reqwest::blocking::RequestBuilder in the current scope

The documentation states "Available on crate features default-tls or native-tls or rustls-tls only."

and thus my cargo.toml attempt is currently:

native-tls = { version = "0.2.2", optional = true }
reqwest = { version = "0.11.11", features = ["native-tls-crate", "default-tls", "native-tls", "blocking"] }

but I cannot seem to find this method!

danger_accept_invalid_certs is a method on ClientBuilder which you linked to. The builder returned from is a RequestBuilder, as the error message notes.

In other words the setting is a property of the client, not the request. So you can't set it on an individual request.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.