Hi team,
How can i remove all query parameters from request before sending it to target endpoint.
I applied Assign message policy.
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-RemoveQueryParams"> <DisplayName>AM-RemoveQueryParams</DisplayName> <AssignVariable> <Name>target.copy.pathsuffix</Name> <Value>false</Value> </AssignVariable> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>
Applied policy on target proxy and request flow.
But it doesn't work.
thanks.
Try using below JS Policy in TargetEndpoint Preflow,
// Print the request before removing the query parameter context.setVariable("MyRequest1", request); // Get all the query parameter names var queryParamNames = context.getVariable('request.queryparams.names'); //convert it to string array. queryParamNames = queryParamNames.toArray(); for (var i = 0; i < queryParamNames.length; i++) { print("queryParamName = " + queryParamNames[i]); // Remove the query parameter from the request context.removeVariable("request.queryparam." + queryParamNames[i]); } // Print the request after removing the query parameters context.setVariable("MyRequest2", request);
This was written by Amar @Devagowda in some early posts.
Try adding the following code to your Assign Message policy
<Remove><QueryParams/></Remove>
Its documented as well. Check the "<Remove>/<QueryParams> element" in this page
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |