URL encoding is lost when making a call out using Named Credentials
Last updated 2016-07-28 ·Reference W-2701061 ·Reported By 1 users
URL encoding is lost when making a call out using Named Credentials. This feature works fine when using Remote Site Settings
1)Create Named Credential: test
URL - https://httpbin.org/get
Identity Type - Anonymous
Authentication Protocol - No Authentication
2) Make a callout from Workbench -> Apex execute
String finalEndpoint = 'callout:test?anonymousBody=';
String code = '2+3';
String urlEncodedCode = EncodingUtil.urlEncode(code, 'UTF-8');
HttpRequest feedRequest = new HttpRequest();
feedRequest.setEndpoint(finalEndpoint + urlEncodedCode);
HttpResponse res = (new Http()).send(feedRequest);
3) Note the output , encoding is lost in the sent URL ( + is treated as append and hence space is seen in the argument value)
"anonymousBody": "2 3"
Expected value is:
None at the moment
Reported By (1)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.