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

javascriptpolicy with multiple queryparams

Not applicable

Hi ,

I am working on Javascript policy,in that javascript needs to process multiple queryparameters,split them into single variables and send as a response.I have created a javascript policy and added to proxy post flow(proxy with no endpoint)

I have written below code:

var queryParamNames = context.getVariable("request.querystring");

var a = queryParamNames.split("&");

var length = a.length;

context.setVariable('test_qparam_names_length', length);

var i = 0;

a.forEach(function(item) { //context.proxyResponse.body.asXML;

context.setVariable('test_qparam_name_found' + i++, true);

// set vehicleord = context.setVariable('test_qparam_name_' + i++, item.toString());

print("vehicle order ",context.setVariable('test_qparam_name_' + i++, item.toString()));

});

I am trying to show all split values as proxy response.

Here is my url:http://proxybasepath/vehicleId?VIN=11&VIN=22&VIN=33

I want to display 11,22,33 as proxy response.I tried using variable 'proxyResponse' ,getting error.

could you please suggest me this.

0 1 309
1 REPLY 1
Top Solution Authors