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 關注
- 176 瀏覽
添加回答
舉報