Is URL query param Encoding default to target

Not applicable

Target URL: http://finance.yahoo.com/q?s=^DJI

When I invoke the above url in postman I get response but,

Issue#1 :

I get error, when I invoke the same url in JS node, the URL is encoded and sent as http://finance.yahoo.com/q?s=%5EDJI

JS code snippet:

var uriStr = 'http://finance.yahoo.com/q?s=^DJI';

var myRequest = new Request(uriStr,"GET",request.headers);

var myResponse= httpClient.send(myRequest);

Please advise how do I send absolute uri without encoding params?

@Maruti Chand , @docs , @Mukundha Madhavan, @Ozan Seymen,@Madhan Sadasivam

0 8 1,365
8 REPLIES 8

Not applicable

@nagesh , Are you using Javascript Policy ?

Yes. that is one approach.

Even I use default target endpoint also that is not working, which is my issue#2

Please let me know if you need more information

That is because the target server is accepting both formats:

Encoded param values: /yahoofinance?s=%5EDJI and Decoded value: yahoofinance?s=^DJI

In my scenario: The target server always accepts something like /info?filter=userinfo::nagesh

but the apigee target endpoint is converting to encoded string as /info?filter=userinfo%3A%3Anagesh

which is why it is not able to process the request.

How do I send the actual paramvalues which have special characters?

@Anil Sagar

@rdave,

Please give your comments on the above

Dear @rdoda,

Could you please help us in above stated issue?

Not applicable

The answer to your question about sending special characters is you percent encode them. If you do not, you can and will have problems with URLs not being parsed correctly.

The problem is a lot of servers do not handle URL decoding correctly. Edge is encoding the URL as required by the appropriate specifications, but the servers are not correctly applying the rules to decode URLs correctly - they should handle percent decoding of any character and reserved characters (which is the case here) correctly. The specification is RFC 3986, section 2.

Of course, this does not really solve your problem.