4

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?

  1. As a text like echo '{"user": "foo"}' | http POST http://example.com
  2. As a file like curl --data '@/path/to/file' http://example.com
Anton Tarasenko
  • 8,099
  • 11
  • 66
  • 91

2 Answers2

2

As of May 17, 2018: This cannot be done with http-prompt. There is an open Github issue on this one.

Praveen Kumar
  • 1,280
  • 1
  • 8
  • 14
0

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.

Tiger-222
  • 6,677
  • 3
  • 47
  • 60
  • 1
    This link seems to be defunct, but relevant docs can be found here: https://httpie.io/docs/cli/request-data-via---raw – lorefnon May 16 '22 at 04:34