Franco Manzur Franco Manzur - 1 year ago 107
Javascript Question

AngularJS - get headers in response

I'm doing a

request to a https service which has an XML file and it need the
to know it size.

This's my code:

method : "GET",
url : ""
function sCallback(data, status, headers, config, statusText) {

console.log( headers('Content-Length') );

}, function eCallback(data, status, headers, config, statusText) {

$log.warn(data, status, headers, config, statusText);


The result of the request is:
"headers is not a function"
Is there another way to get it?

Answer Source

 console.log( data.headers('Content-Length'));
 console.log( data.headers('Content-type'));

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download