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.
<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! Go to Solution.
It's basically due to the statement you made "I am in a hurry" 🙂
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>
It's basically due to the statement you made "I am in a hurry" 🙂
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.
User | Count |
---|---|
7 | |
2 | |
2 | |
1 | |
1 |