1
我必须使用$ httpProvider作为follwos拦截器进行调试我看到,这个方法被调用每个响应(从角文档拍摄)
$httpProvider.interceptors.push(function ($q) {
return {
'response': function (response) {
// look for the antiforgerytoken and update dataService with the same.
return response || $q.when(response);
}
};
});
,当我看在“响应”对象pased我看到只有一个报头,即如下所示
的Accept报头当我看在铬响应分组我看到许多多个报头
我的问题是为什么我无法看到响应中的所有标题?
具体而言,我想读取AntiforgeryToken的Cookie并存储它,我该怎么做?
[无法从Ajax getAllResponseHeaders获取自定义HTTP标头响应]的可能重复(http://stackoverflow.com/questions/15042439/cant-get-custom-http-header-response-from-ajax-getallresponseheaders) – blueberryfields
@blueberryfields不重复,我不使用CORS,我不需要在服务器上做任何特殊的事情。在我的情况下,服务器已经发送了我需要的头文件,我似乎不知道如何获取这些信息。我想知道如何读取拦截器中的所有标题。 – indichimp