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