Postman 的 12 非常棒的功能

137 阅读1分钟

Workspaces and collections

可以有多个 工作区和 集合区 

可以创建变量 记得点 save 不然无法使用 

Environments & Variables

可以创建不同的环境 , 然后设置变量 也要保存 

选择环境即可 使用这个变量 

Examples per Request

Importing and Exporting

import

export collections

export  env 

Pre and Post-request Scripts

请求前后脚本 

Postman uses JavaScript APIs that allow you to write scripts before the request and after the request.

Pre-request

基本 console

添加全局变量

添加请求头

格式化时间 

Post-request (Tests)

这些脚本可以用来处理响应数据、进行断言和验证、设置环境变量等操作

验证200

在控制台中打印响应体的长度

提取响应数据并设置环境变量

Run a Collection

Console Debugging

其实上面已经 使用了  在底部 

Formatting of XML and JSON

Mock Server

如果没有这个选项 ,此处打开 

创建完成后 

会在 collections 里面 增加内容 

浏览器/app 访问需要使用 mock url 

Code Snippet Generator

一般报错后 后端 想要的 就是这个 curl

Build APIs using API Builder

连接代码仓库

Instant Access to Worldwide Public APIs

fork 之后就可以在 collections 里 使用了