Edited at

httpie を使ってみる。

More than 1 year has passed since last update.


httpieを使ってみる。


自分用のメモ

まずhttpieをインストール

brew install httpie

実際にjsonを送ってみる。

http -v POST url key=value

http -v POST http://... title=foo body=bar answer=example created_by=example

POST /problem/problems/create HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 77
Content-Type: application/json

{
"answer": "example",
"body": "bar",
"created_by": "example",
"title": "foo"
}

HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/json; charset=utf-8

Transfer-Encoding: chunked

X-Runtime: 0.017670
X-XSS-Protection: 1; mode=block

{
"answer": [
"can't be blank"
],
"body": [
"can't be blank"
],
"created_by": [
"can't be blank"
],
"title": [
"can't be blank"
]
}

参考 http://qiita.com/yuku_t/items/5df06d50c4c349cc0c1b

         https://github.com/jkbrzt/httpie