LoginSignup
2
2

More than 5 years have passed since last update.

httpie を使ってみる。

Last updated at Posted at 2016-09-09

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

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2