项目作者: crackcomm

项目描述 :
Command line HTTP services client.
高级语言: Go
项目地址: git://github.com/crackcomm/req.git
创建时间: 2016-05-08T01:52:40Z
项目社区:https://github.com/crackcomm/req

开源协议:Apache License 2.0

下载


req

HTTP services client

Install

  1. $ go get -u github.com/crackcomm/req

Usage

  1. # Setting request defaults
  2. $ export REQ_HOST=api.tower.pro
  3. $ export REQ_PATH=v1 # default path prefix
  4. # GET /v1/example/movies/search?title=Pulp+Fiction
  5. # Host: $REQ_HOST
  6. $ req get example movies search -- title="Pulp Fiction"
  7. {
  8. "title": "Pulp Fiction",
  9. "year": 1994
  10. }
  11. # PUT /v1/pkg/example
  12. # Host: $REQ_HOST
  13. #
  14. # {"repository": "git@github.com:username/repo.git", "description": "Example movies database"}
  15. $ req put pkg example -- repository=git@github.com:username/repo.git description="Example movies database"
  16. {
  17. "name": "example",
  18. "description": "Example movies database",
  19. "repository": {
  20. "url": "git@github.com:username/repo.git",
  21. "branch": "master"
  22. }
  23. }
  24. # Request with hostname ($REQ_HOST must be empty)
  25. $ req get google.com
  26. # File upload
  27. $ req put pkg example -- archive=@package.zip description="Example movies database"
  28. # Dump request to console output
  29. # Choose one from: [-v, --verbose, -d, -debug]
  30. $ req -v get me
  31. GET /v1/me HTTP/1.1
  32. Host: $REQ_HOST
  33. ...
  34. # Create etcd API client
  35. $ alias etcdctl="req --host etcd --path v2/keys --format form"
  36. # GET /v2/keys/foo
  37. # Host: etcd
  38. $ etcdctl get foo
  39. # PUT /v2/keys/foo
  40. # Host: etcd
  41. $ etcdctl put foo -- value="hello" ttl=5 prevExist=true