raise fault for invalid verb

sidd-harth
Participant V

I want to raise a fault for invalid request verb. I only want to allow GET and POST verb base on pathsuffix. So my condition and raise fault is as below.

This raises fault for all methods including GET and POST. Apparently I am confused and in a hurry so cannot pinpoint the cause.

@Anil Sagar

<Condition>((request.verb != "GET") or (request.verb != "POST")) and (proxy.pathsuffix MatchesPath "/abc")</Condition>


 <FaultResponse>
        <Set>
            <Payload contentType="application/json">
                \{"error": {
                            "message":"Invalid Verb.", 
                            "detail":"Only GET or POST verbs are valid for the pathsuffix /abc."
                            }
                    }
            </Payload>
            <StatusCode>405</StatusCode>
            <ReasonPhrase>Method not allowed</ReasonPhrase>
        </Set>
    </FaultResponse>
Solved Solved
0 3 562
1 ACCEPTED SOLUTION

@Barahalikar Siddharth ,

It's basically due to the statement you made "I am in a hurry" 🙂

3037-download.png

The raise fault step condition should be ,

<Condition>(!((request.verb = "GET") or (request.verb = "POST")))</Condition>

Create a resource flow / flow condition where path matches "/abc"

<Condition>(proxy.pathsuffix MatchesPath "/abc")</Condition>

View solution in original post

3 REPLIES 3

@Barahalikar Siddharth ,

It's basically due to the statement you made "I am in a hurry" 🙂

3037-download.png

The raise fault step condition should be ,

<Condition>(!((request.verb = "GET") or (request.verb = "POST")))</Condition>

Create a resource flow / flow condition where path matches "/abc"

<Condition>(proxy.pathsuffix MatchesPath "/abc")</Condition>

Thank you @Anil Sagar, I have done this before, it just did not come to my mind today 🙂

@Barahalikar Siddharth , Happens, I was in same shoes while i am working with Apigee Edge. Faced similar issues. Community to the rescue. Never hesitate to ask any question in community.