title: Add authorization header with transformRequest
body: <p>this should be quite easy, but in the end is not working :(.
  We use <strong>Angular 1.4.3</strong>, and we try to add an Authorization header value before some API calls.</p>
  
  <p>Long story short, there is a factory:</p>
  
  <pre><code>angular.module('xxx').factory('factory', function ($resource, addBasicAuth) {
     return $resource(baseUrl, {}, {
        query: {method: 'GET', isArray: true, transformRequest: addBasicAuth},
        ...
     });
  });
  </code></pre>
  
  <p>And the <code>addBasicAuth</code> goes as follows:</p>
  
  <pre><code>angular.module('xxx').factory('addBasicAuth', function ($rootScope) {
      return function (data, headersGetter) {
          var user = ($rootScope.user);
          headersGetter().Authorization = 'Basic ' + Base64.encode(user.username + ':' + user.password);
          return angular.toJson(data);
      };
  });
  </code></pre>
  
  <p>And in theory all should work fine, but for the reason I do not understand, the requestHeader is untouched (checked in Developers Tools/Network - Chrome).</p>
  
  <p>What am I doing wrong? Thanks!</p>