Skip to content

Instantly share code, notes, and snippets.

@codefriar

codefriar/StandardCalloutApex.cls Secret

Last active Mar 4, 2017
Embed
What would you like to do?
HttpRequest req = new HttpRequest();
req.setEndpoint('https://www.codefriar.com/bestBlogPostEver');
req.setMethod('GET');
String username = 'DoYouEvenSecurity?';
String password = 'DontHardcodeCredentials';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.