Reputation: 15122
I'm wondering how to make a POST request with a from data of empty json through HTTPie? The corresponding Curl solution is here:
curl -X POST -H "Content-Type: application/json" -d '{}' http://ooxx.asdf/
Upvotes: 21
Views: 8541
Reputation: 3558
Use <<< operator like below.
http POST ooxx.asdf/ Content-Type:application/json <<< '{}'
Upvotes: 7
Reputation: 16232
Verbatim request data can be specified via redirected STDIN
:
$ echo '{}' | http httpbin.org/post
Note that for requests that include a body:
POST
is the default HTTP methodapplication/json
is the default Content-Type
Upvotes: 30
Reputation: 39375
http POST ooxx.asdf/ Content-Type:application/json '{}'
Another option using json file that contains {}
:
http POST ooxx.asdf/ < file.json
More about json posting you can find from here.
Upvotes: 4