Reputation: 8455
HTTPie fills the request's body with stdin, so it's easy to send raw text or JSON with echo '{...}' | http POST example.com
like here: Sending nested JSON object using HTTPie.
http-prompt
is a handy CLI interface for http and it allows setting body parameters like this:
> user=foo
or also in raw JSON:
> user:=foo
Which set the body to {"user": "foo"}
upon sending.
But how can I send string {"user": "foo"}
as the body directly?
echo '{"user": "foo"}' | http POST http://example.com
curl --data '@/path/to/file' http://example.com
Upvotes: 4
Views: 3748
Reputation: 7150
Such option has been added to HTTPie (--raw
, https://httpie.io/docs/cli/request-data-via---raw) and will be made available for HTTP Prompt shortly.
Upvotes: 2
Reputation: 1310
As of May 17, 2018: This cannot be done with http-prompt. There is an open Github issue on this one.
Upvotes: 2