Azure API 管理 - 液体转换不再有效
Azure API Management - Liquid Transformation does no longer work
我在 Azure API 管理中有几个操作使用液体模板。
几周前我意识到现有的液体模板停止工作了。
我是不是做错了什么? API 管理有问题吗?
基于 documentation 我找不到任何错误。
因此我创建了一个不转换请求正文的基本示例。
政策:
<policies>
<inbound>
<base />
<return-response>
<set-status code="200" reason="OK" />
<set-body template="liquid">
{
"email":"{{body.EmailAddress}}"
}
</set-body>
</return-response>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
要求:
POST https://hidden.azure-api.net/evaluation/mm/liquid HTTP/1.1
Host: hidden.azure-api.net
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
{
"EmailAddress": "sample@lorem.ipsum"
}
回复:
HTTP/1.1 200 OK
content-length: 79
date: Wed, 10 Feb 2021 07:50:53 GMT
vary: Origin
{
"email":""
}
我的期望是变形体:
{
"email":"sample@lorem.ipsum"
}
您是否尝试过将 Content-Type: application/json
header 添加到您的请求中?
Liquid 仅在设置了内容类型时才有效,否则它无法正确解析文档。
Microsoft 支持人员通知我,return-response 策略不支持带有 liquid 模板的 set-body 策略.
我在 Azure API 管理中有几个操作使用液体模板。 几周前我意识到现有的液体模板停止工作了。
我是不是做错了什么? API 管理有问题吗?
基于 documentation 我找不到任何错误。
因此我创建了一个不转换请求正文的基本示例。
政策:
<policies>
<inbound>
<base />
<return-response>
<set-status code="200" reason="OK" />
<set-body template="liquid">
{
"email":"{{body.EmailAddress}}"
}
</set-body>
</return-response>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
要求:
POST https://hidden.azure-api.net/evaluation/mm/liquid HTTP/1.1
Host: hidden.azure-api.net
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
{
"EmailAddress": "sample@lorem.ipsum"
}
回复:
HTTP/1.1 200 OK
content-length: 79
date: Wed, 10 Feb 2021 07:50:53 GMT
vary: Origin
{
"email":""
}
我的期望是变形体:
{
"email":"sample@lorem.ipsum"
}
您是否尝试过将 Content-Type: application/json
header 添加到您的请求中?
Liquid 仅在设置了内容类型时才有效,否则它无法正确解析文档。
Microsoft 支持人员通知我,return-response 策略不支持带有 liquid 模板的 set-body 策略.