0.场景
后端获取小程序用户手机号 ,api文档
使用hutool工具作为http client
1. 正确的写法
正确示例
java
String tencentUrl = StringUtils.format("https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token={}",access_token);
HashMap<String, Object> paramMap = new HashMap<>(1);
paramMap.put("code",jsonRes.getStr("code"));
String jsonStr =JsonUtils.toJsonString(paramMap);
HttpResponse httpResponse = HttpRequest.post(tencentUrl)
.body(jsonStr).execute();