我在用着reqwest = { version = "0.11", features = ["json"] }
impl Client {
pub fn new(/*endpoint: Url*/) -> Result<Client> {
Ok(Client {
client: reqwest::ClientBuilder::new().build()?,
})
}
}
let res = self
.client
.post(url)
.header("Content-type", "application/x-www-form-urlencoded")
.header("Authorization", "Basic".to_owned() + &secret)
.send
.await?;
let data = res.json::<Response>().await?;
我无法设置基本授权标头,并且代码给出了错误“缺少身份验证凭据”。