Anton Tarasenko
Anton Tarasenko

Reputation: 8455

Sending raw body with httpie in http-prompt

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

Upvotes: 4

Views: 3748

Answers (2)

Tiger-222
Tiger-222

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

Praveen Kumar
Praveen Kumar

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

Related Questions