rust post 提交表单

180it 2023-03-03 PM 385℃ 0条
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 请求体是`foo=bar&baz=quux`
    let params = [("id", "88888888"), ("data", "xxxxxxxxxxxxx")];
    let client = reqwest::Client::new();
    let res = client
        .post("http://www.esp56.com/api/httpdclient2/")
        .form(&params)
        .send()
        .await?;

    println!("body = {:?}", res);

    Ok(())
}

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

rust post 提交表单