如下
JSONObject jsonObject = new JSONObject();
jsonObject.put("clientId", clientId);
jsonObject.put("secret", SecureUtil.md5(secret));
jsonObject.put("userId", userId);
Map<String, String > heads = new HashMap<>();
heads.put("Content-Type", "application/json;charset=UTF-8");
String result = HttpRequest.post(userRoleUrl)
.headerMap(heads, false)
.body(jsonObject.toJSONString()).timeout(30*1000).execute().body();
或
JSONObject json = new JSONObject();
json.put("code", config.getCode());
json.put("pass", config.getPass());
String result = HttpRequest.post(config.getUrlPersonal())
.header("Content-Type", "application/x-www-form-urlencoded").form(json).execute().body();
官方例子:https://hutool.cn/docs/#/http/Http%E8%AF%B7%E6%B1%82-HttpRequest