Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Is is possible to set proxy path suffix dynamically ?

Hello ApiGeeks,

I got a scenario to which i want to set proxy path-suffix dynamically,so that request must pass through conditional flow.Below is detail;

1.The client is making a call to a proxy without path suffix, due to which the call is not flowing through conditional flow.

2.Since there are multiple conditional flow, the call should pass through any of this flow based on parameter present in request content.For instance , if the request content contains a parameter as placeOrder the proxy suffix path should set to same.By doing this the call must pass through any of the conditional flow.

3.To achieve this i tried using JS but no fruit. Below is the code:

var json = JSON.parse(context.getVariable("request.content"));
var action = json.result.action;
var path = context.getVariable("proxy.pathsuffix");
if(action == 'placeOrder'){
context.setVariable("proxy.pathsuffix", '/'+action);
}else if(action == 'ViewSingleProduct'){
context.setVariable("proxy.pathsuffix", '/'+action);
}

Attached trace snap.screenshot-112.png.

Any idea how to make this ?Is it really possible to set proxy path-suffix dynamically.Appreciate you help.

Thanks you,

KP

0 10 4,858
10 REPLIES 10