HTTP调式工具之HTTPie

HTTP调式工具之HTTPie


官方网站:

源码安装:
tar -xvf httpie-0.9.3.tar.gz -C /usr/local/src
cd /usr/local/src/httpie-0.9.3
python setup.py install

HTTP调式工具之HTTPie

OS X可以直接
brew install httpie

jlive@MacBook-Pro:~ $brew install httpie

==> Downloading https://homebrew.bintray.com/bottles/httpie-0.9.3.el_capitan.bottle.1.tar.gz

######################################################################## 100.0%

==> Pouring httpie-0.9.3.el_capitan.bottle.1.tar.gz

==> Caveats

Bash completion has been installed to:

  /usr/local/etc/bash_completion.d

==> Summary

🍺  /usr/local/Cellar/httpie/0.9.3: 291 files, 3.7M



相关测试示例请参看官文档,超详细,就不多啰嗦

root@config-p:~#http -a liujun_live@msn.com POST https://api.github.com/repos/jkbrzt/httpie/issues/83/comments body='HTTPie is awesome!'
http: password for liujun_live@msn.com@api.github.com: 

HTTP/1.1 201 Created

Access-Control-Allow-Origin: *

Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval

Cache-Control: private, max-age=60, s-maxage=60

Content-Length: 1243

Content-Security-Policy: default-src 'none'

Content-Type: application/json; charset=utf-8

Date: Fri, 01 Apr 2016 12:51:51 GMT

ETag: "8b3439563fb09148b27a747517375b4a"

Location: https://api.github.com/repos/jkbrzt/httpie/issues/comments/204387596

Server: GitHub.com

Status: 201 Created

Strict-Transport-Security: max-age=31536000; includeSubdomains; preload

Vary: Accept, Authorization, Cookie, X-GitHub-OTP

Vary: Accept-Encoding

X-Content-Type-Options: nosniff

X-Frame-Options: deny

X-GitHub-Media-Type: github.v3

X-GitHub-Request-Id: 70417457:6B9C:1896B356:56FE6EE6

X-RateLimit-Limit: 5000

X-RateLimit-Remaining: 4999

X-RateLimit-Reset: 1459518711

X-Served-By: 2d7a5e35115884240089368322196939

X-XSS-Protection: 1; mode=block


{

    "body": "HTTPie is awesome!"

    "created_at": "2016-04-01T12:51:51Z"

    "html_url": "https://github.com/jkbrzt/httpie/issues/83#issuecomment-204387596"

    "id": 204387596

    "issue_url": "https://api.github.com/repos/jkbrzt/httpie/issues/83"

    "updated_at": "2016-04-01T12:51:51Z"

    "url": "https://api.github.com/repos/jkbrzt/httpie/issues/comments/204387596"

    "user": {

        "avatar_url": "https://avatars.githubusercontent.com/u/7871324?v=3"

        "events_url": "https://api.github.com/users/liujun1990/events{/privacy}"

        "followers_url": "https://api.github.com/users/liujun1990/followers"

        "following_url": "https://api.github.com/users/liujun1990/following{/other_user}"

        "gists_url": "https://api.github.com/users/liujun1990/gists{/gist_id}"

        "gravatar_id": ""

        "html_url": "https://github.com/liujun1990"

        "id": 7871324

        "login": "liujun1990"

        "organizations_url": "https://api.github.com/users/liujun1990/orgs"

        "received_events_url": "https://api.github.com/users/liujun1990/received_events"

        "repos_url": "https://api.github.com/users/liujun1990/repos"

        "site_admin": false

        "starred_url": "https://api.github.com/users/liujun1990/starred{/owner}{/repo}"

        "subscriptions_url": "https://api.github.com/users/liujun1990/subscriptions"

        "type": "User"

        "url": "https://api.github.com/users/liujun1990"


posted @ 2016-04-01 20:50  李庆喜  阅读(368)  评论(0编辑  收藏  举报