Json 在http提示符中使用httpie发送原始正文

Json 在http提示符中使用httpie发送原始正文,json,http,curl,httpie,Json,Http,Curl,Httpie,HTTPie用stdin填充请求的正文,因此使用echo'{…}| http POST example.com发送原始文本或JSON很容易,如下所示: 是一个方便的http CLI接口,它允许设置如下主体参数: > user=foo 或者在原始JSON中: > user:=foo 它在发送时将正文设置为{“user”:“foo”} 但是我如何直接将字符串{“user”:“foo”}作为正文发送呢 作为类似于echo'{“user”:“foo”}http POST的文本http:/

HTTPie用stdin填充请求的正文,因此使用
echo'{…}| http POST example.com
发送原始文本或JSON很容易,如下所示:

是一个方便的http CLI接口,它允许设置如下主体参数:

> user=foo
或者在原始JSON中:

> user:=foo
它在发送时将正文设置为
{“user”:“foo”}

但是我如何直接将字符串
{“user”:“foo”}
作为正文发送呢

  • 作为类似于
    echo'{“user”:“foo”}http POST的文本http://example.com
  • 作为类似于
    curl--data'@/path/to/file'的文件http://example.com

  • 截至2018年5月17日:这无法通过http提示符完成。在这一个上有一个错误。

    使用
    http提示符
    piping
    >httpie post | sh-
    ,但它在细节上失败。