我已经根据用户 ID 存储了一个命名值,因此我可以通过我选择的参考来识别有效负载提交者。
当我使用下面的策略时,我获取字符串形式的值,而不是实际查找命名值。如果我只是将用户 ID 写在双大括号内,而不是从上下文中动态获取它,则查找工作正常,并且会替换为我想要的命名值。
难道就不能用简单的方法来做吗?
<policies>
<inbound>
<set-header name="x-request-context-data" exists-action="override">
<value>{{@(context.User.Id)}}</value>
</set-header>
</inbound>
</policies>
Run Code Online (Sandbox Code Playgroud)
输出:
x-request-context-data: {{@(context.User.Id)}}
Run Code Online (Sandbox Code Playgroud)