-
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

8 Inside Sales Tools that can Help You Meet Your Targets
Are you finding it challenging to meet your monthly/quarterly sales target? Well, maybe you need to improve your productivity. The best performing sales teams always…

Schedular Class in Salesforce | Apex Developer Guide
Scheduler Class To arrange a Pinnacle course to run at standard extends, to begin with, compose a Pinnacle lesson that actualizes the Salesforce-provided interface Schedulable.…
Popular Salesforce Videos
8 Steps to Launch Your App on Salesforce AppExchange
AppExchange is the largest business app store in the world, with over 4,000 apps and millions of users. In this video, we will guide you…
Salesforce Stock CRM Huge News!
Why is Salesforce Stock CRM Stock going UP? Is Salesforce stock a buy? Should I buy CRM Stock? Is Salesforce stock a good investment? In…
SALESFORCE LIGHTS: The Crown above San Francisco
Visible by more than 20 miles away, Jim Campbell's massive LED art installation on the crown of the Salesforce Tower premiered last week. Situated above…
Popular Salesforce Infographics

Top 5 Affordable Salesforce Integration Apps for SMBs
Salesforce is a CRM platform that allows small businesses to manage all of their sales, marketing and customer service communications in one place. Launched back…

Quick Comparison Guide to CRM Systems: Acumatica VS Salesforce Sales Cloud
When you are about to choose, the best and the most appropriate CRM solution for your business, always consider these 3 given points: customization, integration,…

Salesforce in the UK: Fun Facts & Figures
The UK and Salesforce: now, if that relationship wasn’t love at first sight, nothing is! As platinum partners of Salesforce and with an office in…