basic

httpie 可以在终端查看一个 url 的返回结果

在 ubuntu 中安装 httpie:

  1. $ sudo apt-get update
  2. $ sudo apt-get install httpie

使用方法十分简单:

  1. $ http 127.0.0.1

得到:

  1. HTTP/1.1 200 OK
  2. Connection: keep-alive
  3. Content-Encoding: gzip
  4. Content-Type: text/html
  5. Date: Mon, 07 Jan 2019 03:38:20 GMT
  6. ETag: W/"5b46bc18-276"
  7. Last-Modified: Thu, 12 Jul 2018 02:25:28 GMT
  8. Server: nginx/1.10.3 (Ubuntu)
  9. Transfer-Encoding: chunked
  10. <!doctype html><html><head><meta charset="utf-8"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="format-detection" content="telephone=no"><meta name="format-detection" content="email=no"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"><title></title><link rel="stylesheet" href="/static/umi.92f52983.css"></head><body><div id="root"></div><script>window.routerBase = '/';
  11. window.publicPath = '/static/';</script><script src="/static/umi.7a0b20ba.js"></script></body></html>

http methods

  • http POST :5000/user/login

发送 json

localhost:4000/v1/user/login 发送登录请求:

  • http method: PUT
  • data: json {email: 'john@qq.com', password: 111111}
    1. http --json :4000/v1/user/login email='john@qq.com' password=111111