Hi,
I have applied a javascript policy at target request end. where i am checking some path param and query param and creating the target url .
i want to apply certain validation or path param and qurey param so if values are not correct i can directly return the proper http error through apigee without hitting my target server.
is there any way ???
One solution which I can think of is, you can have a variable named raiseFault which can be set toTrue when certain validation failure occurs in javascript.
Then you can use RaiseFault policy to send http error by setting FaultRule condition as ,
<FaultRules> <FaultRule name="FaultinProxy"> <Step> <Name>Raise-Fault-1</Name> </Step> <Condition>(raiseFault = "true")</Condition> </FaultRule> </FaultRules>
thanks @RadhamaniRamadoss,
but how would i stop the flow to hit the target url.
I would like to understand why you want to stop the flow to hit the target url?
You initial query says ,you want to raise error without hitting target server.
yes, i don't want to hit the target server if i found any issue in my incoming request.
if i am setting 'target.url' in my javascript, it will try to hit the target server. so how can i make sure i won't hit the target server.
@Vinay Soni , Find answer to your query here. We believe same will resolve your query. If you feel otherwise please comment here to reopen your question.