在 Debian 上调试接口,如果你说的 Postman 是指 Postman(HTTP 接口调试工具),常见做法如下:
sudo apt update
sudo apt install snapd -y
sudo snap install postman
安装后运行:
postman
如果没有图形界面,可参考下面的“无界面方案”。
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
tar -xvf postman.tar.gz
./Postman/Postman
http://localhost:8080/api/user
Content-Type: application/json)curl -X GET http://localhost:8080/api/user
POST + JSON:
curl -X POST http://localhost:8080/api/user \
-H "Content-Type: application/json" \
-d '{"name":"test"}'
调试详细过程:
curl -v http://localhost:8080/api/user
适合在服务器跑 Postman 集合:
npm install -g newman
newman run example.postman_collection.json
sudo apt install httpie
http GET http://localhost:8080/api/user
http POST http://localhost:8080/api/user name=test
curl http://127.0.0.1:端口
sudo ufw status
修改服务配置,监听 0.0.0.0
curl -k https://xxx
Postman 中关闭 SSL verification(仅测试)
⚠️ 注意:
postman如果你能补充说明:
我可以给你更精确的调试步骤。