curl命令

发布时间 2023-03-22 21:20:09作者: 疯狂阿坤
$ 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"