It turns out libwww-perl has commands named like HTTP methods installed in my /usr/bin.
So `GET http://foo` works. Which is super convenient! Give it a try!
edit: There's a high chance its already installed on your machine.
alias GET='curl -sk'
alias DELETE='curl -sk -X DELETE'
alias PUT='curl -sk -X PUT --data-binary @-'
alias POST='curl -sk -X POST --data-binary @-'
echo "hello" | POST localhost
from the curl(1) manpage:
-X, --request <command>
(...)
Normally you don't need this option. All sorts of GET, HEAD, POST and PUT requests are rather
invoked by using dedicated command line options.
This option only changes the actual word used in the HTTP request, it does not alter the way
curl behaves. So for example if you want to make a proper HEAD request, using -X HEAD will not
suffice. You need to use the -I, --head option.
The method string you set with -X will be used for all requests, which if you for example use
-L, --location may cause unintended side-effects when curl doesn't change request method
according to the HTTP 30x response codes - and similar.
PUT is indicated by using -T / --upload-file, POST by -d / --data or any --data-foo option (eg. --data-raw).
DELETE is the only HTTP method in the parent list that needs -X to be used.$ echo 'hello=world' | POST httpbin.org/post
- Added Python 3 as a dependency for Homebrew installations to ensure some of the newer HTTP features work out of the box for macOS users (starting with HTTPie 0.9.4.).
- Added the ability to unset a request header with Header:, and send an empty value with Header;.
- Added --default-scheme <URL_SCHEME> to enable things like $ alias https='http --default-scheme=https.
- Added -I as a shortcut for --ignore-stdin.
- Added fish shell completion (located in extras/httpie-completion.fish in the Github repo).
- Updated requests to 2.10.0 so that SOCKS support can be added via pip install requests[socks].
- Changed the default JSON Accept header from application/json to application/json, /.
- Changed the pre-processing of request HTTP headers so that any leading and trailing whitespace is removed.
And please Mr. Roztočil stop posting your project here so frequently, there is a limited number of links in this website that get to the front page, and it is annoying to see duplicated content so often. If there is people unaware of your project by now, it is probably people that are not involved in anything related with HTTP debugging, and people that already know the project can easily go to GitHub and see the changelog by themselves, I certainly didn't understand why was this posted again after I started looking for a reason, then found that version 0.9.6 was released :-(
EDIT: Maybe I should blame the +40 accounts who upvoted this.
EDIT2: Re-organized paragraphs to display the changelog before my (irrelevant?) rant about the duplicated submission.
You're right that this submission was unnecessary as there's been plenty of recent general discussions about the project. It would have been better to post a link directly to the new release/changelog and indicate that in the title. That'd probably also lead to fewer upvotes as other HN users would know that this is a feature release, not a new project.
http --json POST https://iad.servers.api.rackspacecloud.com/v2/123456/servers \
'X-Auth-Token':'authtoken' \
'Content-Type':'application/json' \
server:='{
"metadata": {
"metadatagoes": "here"
},
"imageRef": "b21af3ef-1a1e-46b5-98ef-bb0c81b25292",
"networks": [
{
"uuid": "00000000-0000-0000-0000-000000000000"
},
{
"uuid": "11111111-1111-1111-1111-111111111111"
}
],
"flavorRef": "general1-1",
"name": "servername",
"OS-DCF:diskConfig": "MANUAL"
}'server.metadata.metadatagoes+="here" server.imageRef+="..." server.networks+='[...]' ...
Yeah not sure about arrays...
[1] https://github.com/eliangcs/http-prompt, built on HTTPie
[2] https://github.com/cloudhead/http-console, on Node.js
If you want a graphical interface for a HTTP debugging tool like this, I recommend you this tool [1] (only for Mac) or this [2]. I personally prefer Curl, after years using command line tools I got in love with the double dash sign to apply options to the program, and HTTPie unfortunately hides the options and forces you to write the command arguments in a semi-specific order, most people use HTTPie only for the colored output.
The syntax and various options are super easy to learn, output formatting is great and it is overall a lot less clunky than curl for most stuff.
If you haven't checked it yet, just give it a shot.