DEV Community 👩‍💻👨‍💻

DEV Community 👩‍💻👨‍💻 is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for usecase of httpie / httpie使用

Posted on • Updated on

usecase of httpie / httpie使用

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).

Alt Text

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 --trusted-host
Enter fullscreen mode Exit fullscreen mode

测试get请求(testing a GET request):

    http -v GET
Enter fullscreen mode Exit fullscreen mode

测试POST带表单请求(testing a POST request):

 http --form POST username="qiu" password="123456"
Enter fullscreen mode Exit fullscreen mode

测试get请求带cookie(testing a GET request containing cookie):

http -v GET  Cookie:sessionid=vc1d2m5kb1zul63l9g24qq5w58vfj35g
Enter fullscreen mode Exit fullscreen mode

将token包含在header中(testing a GET request containing token):

http -v GET Cookie:sessionid=y4nokqeymk54tdapicjjkmbve1qfuheo Authorization:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InFpdSJ9.qLDaly37vl77SxyHNPEqq6_HKzbSinmPcG9GvGQ-JdQ
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.