{{$.1.response.body.token}}
。{{$.1.response.body.token}}
为例:1
表示步骤 ID,可以在每个测试步骤中找到。response.body
表示前置步骤数据的位置。可以包括请求的 header、body,或者响应的 header、body 等数据。具体见下文。token
表示 body 中下一层级的 token
字段数据。你可以使用 JSONPath 语法提取想要的数据。{{variable}}
语法引用变量,而是要使用 pm.variables.get
引用前置步骤数据。比如:
类别 | 功能 | 语法示例 |
---|---|---|
请求 | URL | {{$.<step id>.request.url}} |
路径参数 | {{$.<step id>.request.pathParam.<field name>}} | |
查询参数 | {{$.<step id>.request.query.<field name>}} | |
请求头 | {{$.<step id>.request.header.<field name>}} | |
请求体(form) | {{$.<step id>.request.body.<field name>}} | |
请求体(json) | {{$.<step id>.request.body.<field path>}} | |
响应 | 响应体 | {{$.<step id>.response.body.<field path>}} |
响应头 | {{$.<step id>.response.header.<field name>}} | |
Cookie | {{$.<step id>.response.cookie.<field name>}} | |
循环 | 元素(ForEach 循环中的数组元素) | {{$.<loop step id>.element.<field path>}} |
索引 | {{$.<loop step id>.index}} |
{{token}}
。