Azure api management 对模拟响应应用压缩
可以对模拟响应应用压缩(gzip)吗?还是仅限于出境区?我试图在出站部分应用模拟,但是我需要“跳过”整个Azure api management 对模拟响应应用压缩,azure-api-management,Azure Api Management,可以对模拟响应应用压缩(gzip)吗?还是仅限于出境区?我试图在出站部分应用模拟,但是我需要“跳过”整个部分,因为还没有后端 下面的策略很有效,我得到了一个很好的json示例,但它没有被压缩 <policies> <inbound> <base /> <set-header name="Content-Encoding" exists-action="override">
部分,因为还没有后端
下面的策略很有效,我得到了一个很好的json示例,但它没有被压缩
<policies>
<inbound>
<base />
<set-header name="Content-Encoding" exists-action="override">
<value>gzip</value>
</set-header>
<mock-response status-code="200" content-type="application/json" />
</inbound>
<backend />
<outbound />
<on-error>
<base />
</on-error>
</policies>
gzip
我实际上是用
让它工作的。因此,如果将来有人偶然发现这一点,以下是完整的政策:
<policies>
<inbound>
<base />
<return-response>
<set-status code="200" reason="OK" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-header name="Content-Encoding" exists-action="override">
<value>gzip</value>
</set-header>
<set-body>{
"success": true,
"data": {
"foo": [
{
"id": 1,
"bar": "xxx"
},
{
"id": 2,
"bar": "yyy"
},
{
"id": 3,
"bar": "zzz"
}
]
}
}</set-body>
</return-response>
</inbound>
<backend />
<outbound />
<on-error>
<base />
</on-error>
</policies>
应用程序/json
gzip
{
“成功”:没错,
“数据”:{
“foo”:[
{
“id”:1,
“酒吧”:“xxx”
},
{
“id”:2,
“条”:“yyy”
},
{
“id”:3,
“酒吧”:“zzz”
}
]
}
}