Postman在Ubuntu上的使用教程匯總
Postman在Ubuntu上的安裝方式主要有四種,可根據需求選擇:
sudo apt update && sudo apt install snapd;再執行sudo snap install postman即可完成安裝。安裝后可直接從應用菜單啟動。sudo tar -xzf Postman-linux-x64-*.tar.gz -C /opt/解壓;創建全局符號鏈接sudo ln -s /opt/Postman/Postman /usr/bin/postman,方便終端直接輸入postman啟動。sudo apt update && sudo apt upgrade;添加Postman官方PPAsudo add-apt-repository https://dl.bintray.com/postman/apt;更新軟件包列表sudo apt update;安裝Postmansudo apt install postman。sudo apt install nodejs npm);運行sudo npm install -g postman全局安裝Postman CLI工具。postman(若已創建符號鏈接);.desktop文件,可直接雙擊桌面圖標。Content-Type: application/json)、請求體(如JSON格式數據,需選擇“raw”+“JSON”格式);pm.test("Status code is 200", function() { pm.response.to.have.status(200); });;驗證響應體是否包含特定字段:pm.test("Response contains user name", function() { var jsonData = pm.response.json(); pm.expect(jsonData.name).to.eql("John Doe"); });。http://proxy.example.com:8080);若代理需要身份驗證,勾選“Proxy authentication”并輸入用戶名、密碼;點擊“Save”保存設置。