Hi Rustaceans
I'm new to rust and reqwest and I'm struggling with getting the payload from a post request I only get the headers. If I do the same in a rest client I'm getting the data I need. Hope some one point me in the right direction.
I'm expecting a xml payload
//Make changes to default
let client = reqwest::Client::builder()
// test only
.danger_accept_invalid_certs(true)
//.default_headers(headers)
.build()
.unwrap();
//http request
let res = client
.post("https://192.168.2.200/sdk/")
.header("SOAPAction","urn:vim25/6.7.1")
.header("Content-type","text/xml; charset=utf-8")
.body(data)
.send();
println!("{:#?}", res);
I have looked at Reqwest post response 200 but no json payload which sound like my problem, but I don't not have the method text() when calling it on res.
error[E0599]: no method named text
found for type std::result::Result<reqwest::Response, reqwest::Error>
in the current scope
--> src\main.rs:40:27
|
40 | println!("{:#?}", res.text());
| ^^^^
error: aborting due to previous error
For more information about this error, try rustc --explain E0599
.
What am I doing wrong and how to fix it?
Thanks