Earlier this year, I have managed the development of a WebApp for industrial supplychain sourcing in our start-up . It's a typical B/S-architecture project whose server side was entirely developed by myself (Ubuntu running over AliCloud + Django + Neo4j + MongoDB + Docker + Tomcat + nginx + other dependences).
Below are some notes about a simple tool called httpie that I used for testing my APIs. These notes were taken in Chinese, however I add also simple translation in English in case someone happens to read this post and wants to understand it.
可以使用pip安装(installing using pip with a specified source):
pip install --upgrade httpie -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
测试get请求(testing a GET request):
http -v GET http://127.0.0.1:8000/suppliers_server/get_user?username=qiu
测试POST带表单请求(testing a POST request):
http --form POST http://127.0.0.1:8000/suppliers_server/query_login username="qiu" password="123456"
测试get请求带cookie(testing a GET request containing cookie):
http -v GET http://127.0.0.1:8000/corporadb/login Cookie:sessionid=vc1d2m5kb1zul63l9g24qq5w58vfj35g
将token包含在header中(testing a GET request containing token):
http -v GET http://127.0.0.1:8000/suppliers_server/query_chain?product=cd Cookie:sessionid=y4nokqeymk54tdapicjjkmbve1qfuheo Authorization:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InFpdSJ9.qLDaly37vl77SxyHNPEqq6_HKzbSinmPcG9GvGQ-JdQ
Top comments (0)