跳到主要内容

curl

使用curl模拟http请求

  • get请求

    curl http://127.0.0.1:8080/login?username=xxx

  • post请求

    curl -d "user=admin&passwd=123456" http://127.0.0.1:8080/login

    curl -H "Content-Type:application/json" -X POST -d '{"user":"admin", "passwd":"123456"}' http://127.0.0.1:8080/login

    -H header

    -X 指定method

    -d body