【发布时间】:2016-11-06 13:21:38
【问题描述】:
我正在向具有 XML 文件的 https 服务发出 $http.get 请求,它需要 headers('Content-length') 才能知道它的大小。
这是我的代码:
$http({
method : "GET",
url : "https://url.com/xml_file.xml"
}).then(
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);
});
请求的结果是:"headers is not a function"。
有没有其他方法可以获取?
【问题讨论】:
-
这是你编的吗?你为什么希望它起作用??
-
是的,我正在这样做。我需要该值来进行验证。这应该根据文档工作
标签: javascript angularjs xml https