1 回答

TA贡献1820条经验 获得超2个赞
鉴于您的响应示例,您可以使用如下内容:
const template = `
<table>
<tr>
<th>Product</th>
<th>Price</th>
<th>Quantity</th>
</tr>
{{#each responseData}}
{{#each items}}
<tr>
<td>{{product}}</td>
<td>{{price}}</td>
<td>{{quantity}}
</tr>
{{/each}}
{{/each}}
</table>
`;
let responseData = []
_.each(pm.response.json().companyGroups, (item) => {
_.each(item.shippingGroups, (nestedItem) => {
responseData.push(nestedItem)
})
})
pm.visualizer.set(template, { responseData })
这只是一个粗略的示例,需要重构,但它表明您可以在表中显示响应数据。
- 1 回答
- 0 关注
- 145 浏览
添加回答
举报