DEV Community

Cover image for usecase of httpie / httpie使用
Z. QIU
Z. QIU

Posted on • Edited on

2 1

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 http://pypi.douban.com/simple --trusted-host pypi.douban.com
Enter fullscreen mode Exit fullscreen mode

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

    http -v GET http://127.0.0.1:8000/suppliers_server/get_user?username=qiu
Enter fullscreen mode Exit fullscreen mode

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

 http --form POST http://127.0.0.1:8000/suppliers_server/query_login username="qiu" password="123456"
Enter fullscreen mode Exit fullscreen mode

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

http -v GET http://127.0.0.1:8000/corporadb/login  Cookie:sessionid=vc1d2m5kb1zul63l9g24qq5w58vfj35g
Enter fullscreen mode Exit fullscreen mode

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

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up