在过去的几天里,我主要是在试验 reqwest 模块,看看我能完成什么,但我遇到了一个我无法解决的问题。我尝试在执行发布请求后检索响应标头值。我尝试的代码是
extern crate reqwest;
fn main() {
let client = reqwest::Client::new();
let res = client
.post("https://google.com")
.header("testerheader", "test")
.send();
println!("Headers:\n{:#?}", res.headers().get("content-length").unwrap());
}
此代码似乎返回此错误
error[E0599]: no method named `headers` found for opaque type `impl std::future::Future` in the current scope