405 Method not found error handlers

Hi Team,

I have a default proxy with multiple endpoints. Each endpoint is having different proxy path suffix and corresponding method. If the pathsuffix is not matching then I have a rasie fault at the end with 404 status code as below

<Flow name="UnknownResource">
    <Request>
        <Step>
            <Name>RF-ResourceNotFoundFlowFault</Name>
        </Step>
    </Request>
    <Response/>
</Flow>

 But, when the pathsuffix is matching and method is incorrect, then in that case I want to raise 405 Method not found. Example. I have defined /testcase_example is the path suffix and POST is the method attached

 

/testcase_ex with POST - should generate 404
/testcase_example with GET call should generate 405

 

Any idea how to achive this? I have tried below after all the flow conditions and before RF-ResourceNotFoundFlowFault. So that if none of the above flow conditions are staisified, then it will come to this flow and execute the raise fault with 405. 

<Flow name="MethodNotFound">
    <Request>
        <Step>
            <Name>RF-MethodNotFoundFlowFault</Name>
(proxy.pathsuffix MatchesPath "/testcase_example")</Condition> </Step> </Request> <Response/> </Flow>

  But challenge is, if any new endpoint is added, then everytime, we need to modify this condition as well by adding the  new proxy path suffix. Otherwise it will not work. 

any easy way to achieve this?

1 0 81
0 REPLIES 0