ValidateRequest json 正文的 Apigee 政策错误

问题描述

我在 apigee 警察身上看到奇怪的行为,这让我在 prod env 中出错,但在 dev 中工作正常。我的 api 是一个带有 json 请求负载的 DELETE 调用。此策略应用于 PreFlow 以验证请求 json。它适用于其他调用,不适用于 DELETE 调用,仅适用于 prod。

以下是我的政策:

<PreFlow name="PreFlow">
        <Request>
            ....
            <Step>
                <Condition>(request.verb != "OPTIONS") and (request.verb != "GET")</Condition>
                <FaultRules/>
                <Name>MV-ValidateRequestJson</Name>
            </Step>
            .....
        </Request>
        <Response/>
</PreFlow>

MV-ValidateRequestJso.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation async="false" continueOnError="false" enabled="true" name="MV-ValidateRequestJson">
    <displayName>MV-ValidateRequestJson</displayName>
    <FaultRules/>
    <Properties/>
    <Source>request</Source>
</MessageValidation>

apigee 上的错误: {"fault":{"faultstring":"MV-ValidateRequestJson 失败原因:"Expecting { or [ at line 1"","detail":{"errorcode":"steps.messagevalidation.Failed"}}}>

错误用户看到: {"error_description":"服务器无法理解该请求。","error":"bad_request"}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)