Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP testing on the command line, is there something better than cURL?

Is there a command line utility where you can simply set up an HTTP request and have the trace simply output back to the console?

Also specifying the method simply would be a great feature instead of the method being a side effect.

I can get all the information I need with cURL but I can't figure out a way to just display it without dumping everything to files.

I'd like the output to show the sent headers the received headers and the body of the message.

There must be something out there but I haven't been able to google for it. Figured I should ask before going off and writing it myself.

like image 443
William Avatar asked Jan 19 '23 18:01

William


1 Answers

I dislike answering my own question but c-smile's answer lead me down the right track:

Short answer shell script over cURL:

curl --dump-header - "$@"

The - [dash] meaning stdout is a convention I was unaware of but also works for wget and a number of other unix utilities. It is apparently not part of the shell but built into each utility. The wget equivalent is:

wget --save-headers -qO - "$@"
like image 112
William Avatar answered Jan 29 '23 07:01

William