Request to add `-d, --data` option for raw body like curl
See original GitHub issueThe request is simple, just to add an option to pass raw data like curl
does:
http :/api/user -d 'MyRawData...'
I know that in mostly cases if you are sending JSON or form data, it can be achieved with the “request items”, like:
http :/api/hey say=Hello to=me …
And it will converted to the proper format depending of the content type, that is awesome! And if you have something that is not a JSON or form data to send, you can do something like:
echo 'MyRawData...' | http :/api/hey
But this is impractical, the main idea of HTTPie is cURL-like tool for humans , and this case is far of that principle, in fact, curl
is more practical than HTTPie for the previous example. Adding more than one command and pipe them with ugly characters like |
<
just because a simple option is missing doesn’t sound human-friendly.
What’s wrong with add the -d
option to http
?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:22 (8 by maintainers)
Top GitHub Comments
you can just do
http POST example.org <<< "foo bar"
orhttp POST example.org < file.name
There’d be nothing particularly wrong with that. I just find piping cleaner and strongly prefer when there is only one way of doing the same thing. Piping exists for this very purpose (i.e. to pass data to programs), and It’s easy to understand, universal, and unambiguous. Every decent CLI tool supports piping (with the notable exception of
curl
) so you only need to learn the concept once.Compare:
httpie
curl