I'm simply trying to access an Http response header key value as specified in the docs,
- public String getHeader(String key)
When I try to save, the compiler is complaining about the method signature. I've tried in a few different orgs to make sure somehow the HttpResponse class hadn't been overridden somehow...
Thanks for any clues/suggestions.
public class HttpTesting {
public HttpTesting() {
String aString = 'aHeaderKey';
HttpRequest anHttpRequest = new HttpRequest();
HttpResponse anHttpResponse = new Http().send(anHttpRequest);
System.debug('---> anHttpResponse.getHeaderKeys(): ' + anHttpResponse.getHeaderKeys());
System.debug('---> anHttpResponse.getHeaderKey(aString): ' + anHttpResponse.getHeaderKey(aString)); // <--- 'Method does not exist or incorrect signature: void getHeaderKey(String) from the type System.HttpResponse'
}
}
Yes I am able to save using belolw code
System.debug('---> anHttpResponse.getHeaderKey(aString): ' + anHttpResponse.getHeader(aString)); // <--- 'Method does not exist or incorrect signature: void getHeaderKey(String) from the type System.HttpResponse'