I'm a newbie to rust and I've been getting buy with the docs and online help but now I'm stumped.
I'm calling a server (for a game*) and I want to log in. I have this working in culr(1), python, and even perl but not rust.
I set-up a client with reqwest::Client::builder() and can call the landing page.
On the next call to login I want to add a Referer header to my client, but I can't seem to do this.
The call I'm trying to make is :
pub async fn get_kol_data(
mut client: Client,
uri: String,
form_data: Form,
body_data: String) {
....
let response = client.post(uri)
.header(
reqwest::header::REFERER,
reqwest::header::HeaderValue::from_static(
"Why doesn't this work?"))
.multipart(form_data)
.body(body_data)
.send()
.await
.expect("Failed to get a response.");
...
}
If you can't update the headers of the client what's the point of reusing the client? It would need to be recreated on multiple calls. So I must be missing something in my understanding.
Many thanks for any help or guidance,
D
*KingdomOfLoathing if you must know. Been going for almost 20 years.