I am exposing a proxy URL in apigee w.r.t. a backend service. I am copying the (Custom) Header value in the proxy side request to queryparams in backend service URL, using Assign Message policy, as given below:
<Set>
<QueryParams> <QueryParam name="Timestamp">{request.header.Timestamp}</QueryParams> <Verb>GET</Verb>
</Set>
I see that the header values having '%' in it are getting manipulated after passing through Assign Message policy. How to prevent Assign Message manipulating it? For example, it's converting '%' in request header to '%25'...
Solved! Go to Solution.
Given this is a get - any params that get assigned to the query string will by necessity be URI encoded.
Your target should be able to do resolve this with something like (javascript example):
var decodedTimestamp=decodeURIComponent(request.queryparam.Timestamp);
If your target can not decode these you should pass them through as a header.
I solved using JavaScript.
First I accessed the headers in JS like this : var field_1 = context.proxyRequest.headers['HEADERNAME'];
Then I build the target side URL (JS is then attached to the Post Flow - Request):
var url = "http://ww.abc.com/someresource?"
context.setVariable("target.url", url + "QUERYPARAM1=" + field_1)
Hope this helps..
-Aneesh.
i think the '%' is just URL encoded, your backend service should be able to decode it without problems.. are you seeing any issues?
Given this is a get - any params that get assigned to the query string will by necessity be URI encoded.
Your target should be able to do resolve this with something like (javascript example):
var decodedTimestamp=decodeURIComponent(request.queryparam.Timestamp);
If your target can not decode these you should pass them through as a header.
Have you found out any workaround to this situation? as i have also been facing this issue since long.
I solved using JavaScript.
First I accessed the headers in JS like this : var field_1 = context.proxyRequest.headers['HEADERNAME'];
Then I build the target side URL (JS is then attached to the Post Flow - Request):
var url = "http://ww.abc.com/someresource?"
context.setVariable("target.url", url + "QUERYPARAM1=" + field_1)
Hope this helps..
-Aneesh.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |