I am attempting to do a post using the reqwest library and following patters that I have found in various places online:
let res = http_client.post(&url)
.header("Content-Type", "application/x-www-form-urlencoded")
.form(&form_data)
.send()
.await?;
println!("authenticate response: {}", res.status)
The code block above causes a compile error:
`?` couldn't convert the error to `std::io::Error` the trait `
`std::convert::From<reqwest::error::Error>` is not implemented for `std::io::Error`
I do not understand why I am getting this error. I have made my code as close to the examples as I can. It will compile if I remove the ?
and the res.status
. But I need to get the status res.status
value. More importantly, I need to understand what I am missing or doing wrong.