在Ubuntu中使用Postman进行API测试和调试,可以遵循以下步骤和技巧:
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xvf postman.tar.gz -C /opt/
sudo nano /usr/share/applications/postman.desktop
在打开的文件中,复制并粘贴以下内容:
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=/opt/Postman/Postman
Icon=/opt/Postman/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
保存并关闭该文件。
sudo npm install -g postman
base_url
,然后在请求URL中使用{{base_url}}
占位符。const data = pm.globals.get("data");
pm.request.url.query.set(data);
const postman = require('postman');
const collection = new postman.Collection('collection_id');
通过这些技巧,你可以在Ubuntu中高效地使用Postman进行API测试和调试,提升工作效率。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>