Setting application wide HTTP headers in AngularJS

前端 未结 3 882
广开言路
广开言路 2020-12-01 02:59

Is there a way to set the $httpProvider headers outside of angular.module(\'myApp\', []).config()?

I\'m getting an Auth-Token from the serv

3条回答
  •  孤城傲影
    2020-12-01 03:25

    $http.defaults.headers.common['Auth-Token'] = 'token';
    

    It seems headers() normalizes the key names.

提交回复
热议问题