Curl to return http status code along with the response

后端 未结 12 1152
我在风中等你
我在风中等你 2020-12-04 08:24

I use curl to get http headers to find http status code and also return response. I get the http headers with the command

curl -I http://localhost

12条回答
  •  借酒劲吻你
    2020-12-04 08:34

    This command

     curl http://localhost -w ", %{http_code}"
    

    will get the comma separated body and status; you can split them to get them out.

    You can change the delimiter as you like.

提交回复
热议问题