cURL to show response headers after submiting a file

Use -i

From the cURL manual

 -i, --include       Include protocol headers in the output (H/F)

Note also:

-I, --head          Show document info only

The first will show headers, followed by body. The second will send a HEAD request so can’t be used in your example as you’re POSTing data.

Edit

The header output using -i is echoed to stdout, the same as the request body so directing the response into a PDF file will create an invalid PDF.

So I suggest instead you use -v which will be much noisier, but will show headers on command line when directing stdout to file, because verbose output goes to stderr.

Leave a Comment