curl

1. curl post json
request:curl http://127.0.0.1:9098/hello -X POST -H 'Content-Type: application/json' -d '{
    "username": "zhang_san",
    "password": "md5(zhang_san)"
}'
response:{"code":200,"msg":"success"}

2. curl post json and get response of http_code
request:curl http://127.0.0.1:9098/hello -X POST -H 'Content-Type: application/json' -d '{
"username": "zhang_san",
"password": "md5(zhang_san)"
}' -w ' [http_code: %{http_code}]'
response:{"code":200,"msg":"success"} [http_code: 200]

原文地址:https://www.cnblogs.com/hezhixiong/p/12356321.html