win7下IntelliJ IDEA使用curl
curl是利用URL语法在命令行方式下工作的开源文件传输工具
curl命令可以在开发web应用时,模拟前端发起的HTTP请求
1.下载curl
https://curl.haxx.se/download.html
我选择的,Windows 64 bit 7.65.3 binary the curl project,curl-7.65.3_1-win64-mingw.zip
2.解压
curl-7.65.3_1-win64-mingw
3.设置环境变量
set PATH=E:\software\curl-7.65.3_1-win64-mingw\bin;%PATH%
4.配置IntelliJ IDEA
file——>settings——>Terminal
5.使用,打开
测试:
E:\software\curl-7.65.3_1-win64-mingw\bin>curl baidu.com
<html>
<meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
</html>
-i 详细信息
E:\software\curl-7.65.3_1-win64-mingw\bin>curl -i baidu.com
HTTP/1.1 200 OK
Date: Mon, 02 Sep 2019 06:11:13 GMT
Server: Apache
Last-Modified: Tue, 12 Jan 2010 13:48:00 GMT
ETag: "51-47cf7e6ee8400"
Accept-Ranges: bytes
Content-Length: 81
Cache-Control: max-age=86400
Expires: Tue, 03 Sep 2019 06:11:13 GMT
Connection: Keep-Alive
Content-Type: text/html
<html>
<meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
</html>
E:\software\curl-7.65.3_1-win64-mingw\bin>curl localhost:8080/find
[{"id":1,"name":"111"},{"id":2,"name":"222"},{"id":33,"name":"abc"},{"id":34,"name":"xyz"},{"id":65,"name":"abc"},{"id":66,"name":"xyz"}]
E:\software\curl-7.65.3_1-win64-mingw\bin>curl -i localhost:8080/find
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 02 Sep 2019 06:13:16 GMT
[{"id":1,"name":"111"},{"id":2,"name":"222"},{"id":33,"name":"abc"},{"id":34,"name":"xyz"},{"id":65,"name":"abc"},{"id":66,"name":"xyz"}]
模拟formdata数据
E:\software\curl-7.65.3_1-win64-mingw\bin>curl localhost:8080/api/getPost -X POST --data "id=1&name=abc"
{"id":1,"name":"abc","other":null,"string":" id=1 name=abc other=null"}
json数据
E:\software\curl-7.65.3_1-win64-mingw\bin>curl localhost:8080/api/getPostJson -X POST -H "Content-Type:application/json" --data "{\"id\":\"1\",\"name\":\"abc\",\"other\":\"\"}"
{"id":1,"name":"abc","other":"","string":" id=1 name=abc other="}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
2015-09-02 基础入门