gpt4 book ai didi

azure - 如何在 Azure API 管理中指定查询字符串参数的重写 url

转载 作者:行者123 更新时间:2023-12-02 09:11:46 24 4
gpt4 key购买 nike

我正在使用 Azure API 管理将传入的查询字符串转换为另一个查询字符串。

我的转换代码是:

<policies>
<inbound>
<rewrite-uri template="api/primes?a={a}&b={b}" />
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>

当我尝试保存编辑时,出现错误:

One or more fields contain incorrect values: 
'=' is an unexpected token. The expected token is ';'. Line 15, position 50.

指的是a={a}中的等号。如何更正 rewrite-uri 的模板?输入网址例如为 https://example.com/sum?a=7&b=5

最佳答案

尝试替换:

<rewrite-uri template="api/primes?a={a}&b={b}" />

与:

<rewrite-uri template="api/primes?a={a}&amp;b={b}" />
<小时/>

欲了解更多详情,请访问 https://azure.microsoft.com/en-us/blog/policy-expressions-in-azure-api-management/ .

关于azure - 如何在 Azure API 管理中指定查询字符串参数的重写 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51254160/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com