curl -I 与 curl -i 返回的头部信息不一致

分类: Shell脚本编程

可能是golang的框架导致 curl -I 与 curl -i 返回的头部信息不一致,声明调用的方式为GET就正常了


如下图:


curl -I -X GET "http://localhost:8080/home/hi"


30/11/2022   14:49.48   /home/mobaxterm  curl  -i http://localhost:8080/home/hi
HTTP/1.1 200 OK
Date: Wed, 30 Nov 2022 06:50:52 GMT
Content-Length: 5
Content-Type: text/plain; charset=utf-8✔

world



30/11/2022   14:49.48   /home/mobaxterm  curl  -I http://localhost:8080/home/hi
HTTP/1.1 404 Not Found
Date: Wed, 30 Nov 2022 06:49:52 GMT
Content-Length: 9
Content-Type: text/plain; charset=utf-8✔ 


30/11/2022   14:49.52   /home/mobaxterm  curl  -I "http://localhost:8080/home/hi"
HTTP/1.1 404 Not Found
Date: Wed, 30 Nov 2022 06:50:09 GMT
Content-Length: 9
Content-Type: text/plain; charset=utf-8✔ 


30/11/2022   14:50.09   /home/mobaxterm  curl  -I -X GET "http://localhost:8080/home/hi"
HTTP/1.1 200 OK
Date: Wed, 30 Nov 2022 06:50:52 GMT
Content-Length: 5
Content-Type: text/plain; charset=utf-8✔


30/11/2022   14:50.52   /home/mobaxterm  curl  -I -X HEAD "http://localhost:8080/home/hi"
HTTP/1.1 404 Not Found
Date: Wed, 30 Nov 2022 06:51:02 GMT
Content-Length: 9
Content-Type: text/plain; charset=utf-8
posted @   爱折腾的大臭臭  阅读(1286)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示