为什么 Postman 的 Visualize 渲染没有 HTML 样式

Why isn't Postman's Visualize rendering HTML styling

给出以下 JSON 响应:

[
    {
        "Key": "Foo",
        "Value": "This does not have HTML styling."
    },
    {
        "Key": "Bar",
        "Value": "<i>This</i> has <b>some</b> HTML styling."
    }
]

并使用以下可视化响应:

var template = `
    <table>
        <tr>
            <th>Key</th>
            <th>Value</th>
        </tr>

        {{#each response}}
            <tr>
                <td>{{Key}}</td>
                <td>{{Value}}</td>
            </tr>
        {{/each}}
    </table>
`;

pm.visualizer.set(template, {
    response: pm.response.json()
});

为什么未呈现 和 样式?

为了呈现 HTML 样式,需要“triple-stash”。请参阅 handlebarsjs 的文档,Postman 似乎将其用于“可视化”选项卡。

替换

<td>{{Value}}</td>

<td>{{{Value}}}</td>