curl命令

$ curl url地址 -X POST/GET -d 参数 --header 请求头 
例:curl http://localhost:9301/testpost -X POST -d '{"name":"张三","age":"12"}' --header "Content-Type:application/json"

注:

1、window下-d后面的参数不需要外面的单引号

如:curl http://localhost:9301/testpost -X POST -d {"name":"张三","age":"12"} --header "Content-Type:application/json"

2、--header等效于-H

如:curl http://localhost:9301/testpost -X POST -d '{"name":"张三","age":"12"}' -H "Content-Type:application/json"

 

posted @ 2023-03-22 17:28  疯狂阿坤  阅读(25)  评论(0编辑  收藏  举报