-
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
Field Service Innovations with Einstein GPT and Salesforce CRM
Integrating cutting-edge technologies has become paramount in the rapidly changing environment of industries, where consumer satisfaction and operational effectiveness are crucial. The integration of Einstein…
Top Salesforce Trends To Watch Out In 2024
The cloud is a powerful tool that can help businesses grow exponentially. Top Salesforce CRM Trends in 2024 Let’s dig deeper into the current trends…
Salesforce Integration with LinkedIn - Here's All You Need to Know
The general approach to selling doesn’t work as effectively in today’s world. You cannot expect extraordinary results by pushing out bulk emails to every prospect…
Popular Salesforce Videos
Salesforce Lightning Tutorial | Salesforce Training | Lightning Training Video
This Salesforce Lightning Tutorial will explain the concept of lightning components along with the lightning component capabilities. Lightning includes the Lightning Component Framework and some…
What Is Salesforce Industries (Vlocity)?
Vlocity (Salesforce Industries) offers pre-built solutions on the Salesforce platform that solve the needs of particular industries that require CRMs to be heavily customized beyond…
6 Best Salesforce Development Training Courses | Learn Salesforce Development Easily
In this video, I'm talking about the 6 Best Salesforce Development Training Courses that are available over Udemy for the novice or Intermediate Salesforce Developer.…
Popular Salesforce Infographics
See How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…
9 Ways Salesforce Brings Companies and Customers Together
As the world’s #1 CRM, Salesforce brings companies and customers together. This is possible through Salesforce Customer 360. It’s an integrated, AI-powered customer relationship management…
Top Salesforce Trends For 2023
When it comes to managing customer databases, Salesforce is leading the pack. Companies are increasingly relying on this powerful tool for its unrivalled flexibility and…