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