4 ms·
Thanks for the feedback! I tried to come up with syntax that would make the most common tasks (i.e., sending JSON objects, submitting forms, setting headers, e
by jkbr 14y ago
Thanks for the feedback!
I tried to come up with syntax that would make the most common tasks (i.e., sending JSON objects, submitting forms, setting headers, etc) as easy as possible and also feel "natural". The reason for the chosen style is that it quite corresponds to the actual HTTP request being sent. For example, if you want to send a PATCH request with a custom header and a form field data:
PATCH /patch HTTP/1.1
X-API-Token: 123
Host: httpbin.org
Content-Type: application/x-www-form-urlencoded; charset=utf-8
foo=bar
You can simply copy the header (X-API-Token: 123) and the data (foo=bar) and paste it to the terminal:
http --form PATCH httpbin.org/post X-API-Token:123 foo=bar
It's not as obvious as '--request PATCH --header X-API-Token:123 --form foo=bar', but on the other hand, the command doesn't include almost anything that wouldn't become part of the actual request, which makes it short and easy to focus on what's important.
- benatkin 14y agoHmm, that makes more sense. If it isn't already in the README or man page, it might be a worthy addition. I suggest you add an option where you can start off with a bare request. Is there a way to have it construct the query string when you are doing a GET request? Also is there a way to have it construct a query string when you have a JSON or form body? Might be something to add below the description of items, as something that doesn't fit into that list but is related. Perhaps -q page=2 -q rpp=20 would be a good way of saying it.
- jkbr 14y ago> Hmm, that makes more sense. If it isn't already in the README or man page, it might be a worthy addition. Good point, I'll add it to the README. > Is there a way to have it construct the query string [...] Not yet, but it's being already discussed here: https://github.com/jkbr/httpie/issues/61 https://github.com/jkbr/httpie/issues/61