在 Ubuntu 下使用 Postman 调试接口,一般流程如下(从安装到常用调试技巧):
chmod +x Postman-linux-x64-*.AppImage
./Postman-linux-x64-*.AppImage
sudo snap install postman
GET / POST / PUT / DELETEhttp://localhost:8080/api/test)Content-Type: application/json
Authorization: Bearer xxx
raw → JSON{
"username": "admin",
"password": "123456"
}
点击 Send,查看:
Ctrl + Alt + C)base_url = http://localhost:8080
{{base_url}}/api/test
如果是本地后端:
curl http://localhost:8080/api/test
确认服务在跑,再在 Postman 测试
console.log(pm.response.json());
pm.test("状态码为200", () => {
pm.response.to.have.status(200);
});
./Postman.AppImage --no-sandbox
0.0.0.0127.0.0.1 而非 localhost如果你有具体调试场景(如:Spring Boot / Node / WebSocket / 文件上传),可以告诉我,我给你更针对性的步骤。