引入包类
HttpUtill GET请求cn.hutool hutool-all 5.7.22
String s = HttpUtil.get("http://127.0.0.1:8888/api/foodListPage/1/5");
System.out.println(s);
POST请求
HashMap上传请求paramMap = new HashMap<>(); paramMap.put("title","张三"); String post = HttpUtil.post("http://127.0.0.1:8888/api/post", paramMap); System.out.println(post);
HashMap下载请求paramMap = new HashMap<>(); paramMap.put("file", FileUtil.file("E:\视屏\图片\shengun.work.certificate.jpg")); String result= HttpUtil.post("http://127.0.0.1:8888/img/upload", paramMap); System.out.println(result);
String fileUrl = "https://img14.360buyimg.com/pop/jfs/t1/199711/20/10806/315681/61566af0Ebf948d09/8d5b739d7c601795.jpg";
long download = HttpUtil.downloadFile(fileUrl, FileUtil.file("D:\pdf"));
System.out.println("Download size: " + download);



