问题遇到的现象和发生背景
rust开发调用企业微信接口 reqwest post 发送消息接口 不懂调用方法
用代码块功能插入代码,请勿粘贴截图
let mut data: HashMap<&str, &str> = HashMap::new();
data.insert("touser", "jiancheng");
data.insert("msgtype", "text");
data.insert("agentid", "1000022");
data.insert("text", "content:123");
data.insert("safe", "0");
Ok(client.post("https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=access_token")
.headers(headers)
.json(&data)
.send()
.await?
.json::<HashMap<String, Value>>()
.await?)
运行结果及报错内容
String("Warning: wrong json format. empty content, hint: [1669725657235732991226803],
我的解答思路和尝试过的方法
过往几天一直想思路 text嵌套hashmap 但是data定义只能插入字符串 编译器无法通过
我想要达到的结果
reqwest正确提交嵌套json格式 谢谢