-
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
Bringing the best of both worlds – AMS 360 Integration with Salesforce
AMS 360 Integration with Salesforce – Insurance is linked with everyone in some way or the other, be it personal insurance, property insurance, automobile insurance,…
RemoteAction Annotation In Apex | Salesforce Apex Developer Guide
Annotations: An Apex annotation, like a Java annotation, modifies how a method or class is used. Annotations begin with a @ symbol and are followed…
How to Solve Sales & Marketing Misalignment Using Sales Cloud Features
Sales and marketing misalignment remains a major challenge for growing businesses. Recent data shows that only about 23% of sales professionals say their company’s sales…
Popular Salesforce Videos
Write Tableau CRM Data to Salesforce Objects
Use Tableau to blend Salesforce data from across the Customer 360 platform with your other business data for increased visibility and a deeper understanding of…
What is Salesforce CRM?
What is Salesforce CRM? Join this useful group for Salesforce job & career info and learn all about Salesforce CRM.
Zero Bug Revolution Episode 05 : The Expert Advice with Deepak Visweswaraiah.
"Join us on ""Zero Bug Revolution: The Expert Advice"" with Rupesh Garg, our CEO, and Deepak Visweswaraiah, VP of Platform Engineering at Pega, for a…
Popular Salesforce Infographics
5 steps to follow for successful Salesforce Implementation
Although implementing Salesforce is designed to help you meet the challenges of your business, it might not provide the results you want, whether it is…
Salesforce Operations/Demographics
Salesforce, the world’s No. 1 CRM Company, has significantly changed the way how business software is delivered and used. Salesforce has found the perfect way…
Infographic: State of Service 2019
Did you know that 64% of people think that customer experience is more important than price in their choice of brand? The new trends in customer service…