根据此示例,我应该能够get
在使用客户端构建器实例化的客户端上运行:
use reqwest::header;
let mut headers = header::Headers::new();
headers.set(header::Authorization("secret".to_string()));
// get a client builder
let client = reqwest::Client::builder()
.default_headers(headers)
.build()?;
let res = client.get("https://www.rust-lang.org").send()?;
下面是我写的代码。
let client = Client::builder()
.gzip(true)
.timeout(Duration::from_secs(10))
.build();
let resp = client.get("https://wiki.mozilla.org/images/f/ff/Example.json.gz");
这是我得到的错误:
error[E0599]: no method named `get` found for type `std::result::Result<reqwest::Client, reqwest::Error>` in the current scope
--> examples/gzipped_http_files.rs:86:23
|
86 | let resp = client.get("https://wiki.mozilla.org/images/f/ff/Example.json.gz");
我究竟做错了什么?