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”保存设置。