在 Ubuntu 上“测 Postman”通常有三种理解,我先分情况说明,你对照看是哪一种:
如果你是想知道 怎么在 Ubuntu 上使用 Postman 发请求:
方式 A:Snap(推荐)
sudo snap install postman
安装完成后,在应用菜单搜索 Postman 即可。
方式 B:官网下载
tar -xzf Postman-linux-x64-*.tar.gz
./Postman/Postman
打开 Postman → New → Request
GEThttps://jsonplaceholder.typicode.com/posts/1如果你是说“不用 Postman 界面,在 Ubuntu 上测接口”:
curl -X GET https://jsonplaceholder.typicode.com/posts/1
curl -X POST https://example.com/api \
-H "Content-Type: application/json" \
-d '{"name":"test"}'
如果你是写测试用例并在 Ubuntu 上运行:
sudo apt update
sudo apt install nodejs npm
sudo npm install -g newman
Postman → Collection → Export → 得到 xxx.json
newman run xxx.json
可以检查:
postman --version
或
which postman
如果你能补充一句:
我可以直接给你一套适合你场景的操作步骤。