curl常用命令

原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11484512.html

 

GET

1 curl protocol://address:port/url?args
2 
3 curl http://127.0.0.1:8080/login?username=hello&password=world

 

POST

1 curl -d "args" protocol://address:port/url
2 
3 curl -d "username=hello&password=world" http://127.0.0.1:8080/login

 

POST with json body

1 curl -H "Content-Type: application/json" -X POST --data (json.data) protocol://address:port/url
2 
3 curl -H "Content-Type: application/json" -X POST --data '{"username": "whoami"}' http://127.0.0.1:8080/login

 

posted @ 2019-09-08 10:07  李白与酒  阅读(222)  评论(0编辑  收藏  举报