After a jQuery.ajax()
call jqXHR.getAllResponseHeaders()
won't return all the headers. The server responded with the following headers:
Connection: keep-alive
Content-Length: 64
Content-Type: application/json
X-My-CustomHeader: whatever
getAllResponseHeaders()
returned only:
Content-Type: application/json
What am I doing wrong?
Example
var request = {
'url': 'http://api.someExternalDomain.com/resource/',
'type': someMethod,
'success': function(data, textStatus, jqXHR) {
console.log(jqXHR.getAllResponseHeaders());
}
};
$.ajax(request);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…