System.out.println("--------------------------------get请求-----------------------------------");
HashMap<String, Object> getParamMaps = new HashMap<>(1);
getParamMaps.put("userName", 1);
HttpResponse getResponse = HttpRequest.get("http://192.168.0.115:8080/v1/users/studentPage/1/3")
.header("Content-Type", "application/json")
.header("token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyLTAtc3ViQWRtaW4tMCJ9.fDSbvfV6Y2LN9c1kYbVEGtGqfRNBs-pOVjtTZ1sGr1w").form(getParamMaps).execute();
int status1 = getResponse.getStatus();
System.out.println("请求响应状态码:" + status1);
String body1 = getResponse.body();
System.out.println(body1);
JSONObject jsonObject1 = JSONObject.parseObject(body1);
Object msg1 = jsonObject1.get("msg");
System.out.println(msg1);
Object code1 = jsonObject1.get("code");
System.out.println(code1);
hutool调第三方接口
最新推荐文章于 2023-12-15 10:57:58 发布