Skip to main content
Lionel Yang a posé une question dans #Apex
Hi folks, 

This seems like a weird one (must be dead simple, but not seeing it).

I'm simply trying to access an Http response header key value as specified in the docs,

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'

}

}

 
4 réponses
  1. 15 janv. 2018, 06:16

    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'

     
0/9000