在 Linux 下使用 Postman 测试接口,常见有三种方式:
# Ubuntu / Debian
sudo snap install postman
# 或使用官方压缩包
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
tar -xvf postman.tar.gz
./Postman/Postman
GET / POST / PUT / DELETEhttp://localhost:8080/api/user
Content-Type: application/json)npm install -g newman
api_test.jsonnewman run api_test.json
✅ 适合:
如果只想快速测试接口,也可以用 curl:
# GET
curl http://localhost:8080/api/user
# POST JSON
curl -X POST http://localhost:8080/api/user \
-H "Content-Type: application/json" \
-d '{"name":"test"}'
如果你愿意,可以告诉我:
我可以给你更具体的示例。