-
write test class for htttp request
Help to write test class for htttp request I can't figure it out
public with sharing class currencyRates {
@AuraEnabled
public static List<Object> getRates(){
String requestData='https://www.nbrb.by/api/exrates/rates?periodicity=0';
Http http =new Http();
HttpRequest request = new HttpRequest();
request.setEndPoint(requestData);
request.setMethod('GET');
HttpResponse response = http.send(request);
List<Object> result =null;
if(response.getStatusCode()==200){
result =(List<Object>)JSON.deserializeUntyped(response.getBody());
}else{
ApexPages.Message mes =new ApexPages.Message(ApexPages.Severity.ERROR,'There was an error in reading Data');
}
return result;
}
}
Log In to reply.
Popular Salesforce Blogs
Commonly Made Mistakes in Salesforce Integration and How One Can Avoid Them
Hey you all, Bienvenue to my blog which is going to tell you about Integration and what few common mistakes occur at the time of…
‘The Killers’, And What’s Not Killing At Salesforce Connections ’18!
Salesforce Connections 2018 is just around the corner and we are as excited as you guys are! “The Killers” are coming to rock the event…
Implementation of Dynamic Search in Salesforce Lightning Component
Today, I am sharing the code, that, how you can implement Dynamic Search using Lightning Component. For this task, we need three things:- A Lightning…
Popular Salesforce Videos
How To Use RingCentral App In Salesforce | Salesforce Service Cloud
Learn how to use RingCentral App in Salesforce. This video will cover the following points - 1. Advantages Take a look at the advantages of…
Salesforce Mobile Publisher Demo
With Salesforce Mobile Publisher, you can create pixel-perfect mobile applications for employees, customers, and partners. Check out this video and learn all you need to…
Salesforce JMS Integration Using MuleSoft | Salesforce Tutorial
Salesforce JMS Integration. In this video, the following points will be covered - 1. Introduction Learn how to use queues to integrate data in Salesforce.…
Popular Salesforce Infographics
Leverage Nonprofit trends with Salesforce Nonprofit Cloud
Salesforce Nonprofit Cloud is a suite of tools designed to help nonprofits take advantage of the latest trends and technologies. With the Nonprofit Cloud, your…
Enhance Customer Experience With Salesforce
Salesforce Makes Personalized, Consistent Digital Customer Experience a Reality. Salesforce, widely recognized as the leader in business CRM, gives organizations the tools they need to…
DreamOle Event - Salesforce
A group of volunteers within the Spanish Salesforce Trailblazer Community. Their Mission is to put together a Community Conference that would help the Spanish Community…