use http::{HeaderName, HeaderValue, header};
const HEADER_ORDER: &[HeaderName] = &[
header::USER_AGENT,
header::ACCEPT_LANGUAGE,
header::ACCEPT_ENCODING,
header::CONTENT_LENGTH,
header::COOKIE,
];
#[tokio::main]
async fn main() -> Result<(), rquest::Error> {
let client = rquest::Client::builder()
.headers_order(HEADER_ORDER)
.cookie_store(true)
.build()?;
let url = "https://tls.peet.ws/api/all".parse().expect("Invalid url");
client.set_cookies(&url, [HeaderValue::from_static("foo=bar")]);
let resp = client.post(url).body("hello").send().await?;
println!("{}", resp.text().await?);
Ok(())
}