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
The -i option is the one that you want:
-i
curl -i http://localhost
-i, --include Include protocol headers in the output (H/F)
Alternatively you can use the verbose option:
curl -v http://localhost
-v, --verbose Make the operation more talkative