$ http拦截器不会在其参数中使用哈希获取GET请求

时间:2017-01-18 16:16:35

标签: angularjs angular-http-interceptors

我遇到了angularjs拦截器的问题。这是我的代码:

    angular
    .module('app')
    .factory('httpInterceptor', ['$q', '$rootScope',
        function ($q, $rootScope) {

            return {
                request: function (config) {

                    console.log(config);
                    return config || $q.when(config);
                },
                response: function (response) {

                    console.log(config);
                    return response || $q.when(response);
                },

                responseError: function (response) {

                    return $q.reject(response);
                }
            };
        }
    ]).config(['$httpProvider', function ($httpProvider) {
    $httpProvider.interceptors.push('httpInterceptor');
}]);

我有图片的GET请求

... / api / download?hash = unit:logo:564& random = 201701181648411382

和json响应的另一个GET请求

... / API /查询/

所以这就是问题所在。为什么interseptor没有看到第一种请求?

第二个通常在控制台中显示。第一个被拦截器扼杀了。 有可能解决这个问题吗?

这两个请求都需要Cookie提供的身份验证令牌。我需要在每次请求后重写此令牌。

由于

0 个答案:

没有答案
相关问题