-
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
How to Access, Create, and Deploy Salesforce Einstein Analytics Dashboard
With the increasing database from different organizations, there is a need for efficient tools to inspect all the data. A cloud-based data analytics tool, Einstein…
What is Predictive Lead Scoring in 2023?
In today’s business world, understanding the customer in detail is a vital requirement for success. With the explosion of Big Data and Artificial Intelligence (AI),…
Guide to CPQ Tools in Salesforce: Find the Perfect Fit for Your Business
Ever spent hours crafting a quote in Salesforce, only to realize you forgot a discount or made a pricing error? You're not alone. Manually building…
Popular Salesforce Videos
Crash Course on Apex Triggers Salesforce | Complete Guide with Real Time Scenarios
Complete guide on Apex Triggers Salesforce 0:00 Intro 0:33 Is Triggers difficult to Learn 0:50 What is Trigger? 3:03 What are Trigger events? 11:55 How…
Skills for Salesforce Field Service | Optimize Customer Service for Businesses | Salesforce Webinar
One way to optimize customer service operations is by having the right technician for the right job. How? Skills for Salesforce Field Service is the…
Welcome to Email Template Builder | Salesforce Learning
In this video, you will learn how to create email templates with Email Template Builder and Email Content Builder. If you have any doubts or…
Popular Salesforce Infographics
How a CRM Platform can Immediately Impact your Business
Selecting the best CRM for small businesses is not a one-size-fits-all endeavor. If you’re new to working with a CRM platform, you often have to…
Salesforce Experience Cloud Benefits For Business Growth
Explore How Salesforce Experience Cloud Can Help Your Business? Get bespoke solutions including: Data integration, time & cost savings.
The Definitive Guide to Salesforce Sandboxes [Infographic]
Sandbox is a copy of your production organization. You can create multiple copies of your organization in separate environments for different purposes such as development,…