title: AngularJS - How to deflate and encode/decode to base64 all jsons request?
body: <p>Lets say i have several $resources and some $http around my angular application:</p>
  
  <pre><code>myApp.factory('Note', function($resource) {
  
    return $resource('http://', {id: '@id'}, 
      { 'index': { method: 'GET', isArray: true },
        'update': { method: 'PUT'},
      });
    });
  </code></pre>
  
  <p>with controller</p>
  
  <pre><code>myApp.controller('NotesController',function NotesController($scope, Note, AuthenticationService) {
  
  $scope.notes = Note.index({}, function(data){
      console.log('success, got data: ', data);
      $scope.response = "yoy!"
    }, function(err){
      console.log('error, got data: ', err);
      $scope.response = "yay!"
    }); 
  });
  </code></pre>
  
  <p>and some request are made by $http directly like authentication</p>
  
  <pre><code>var request = $http.post('http://', {email: email, password: password});
  </code></pre>
  
  <p>Where and How i can tell angular to deflate and encode/decode JSONs to base64 before the actual request is made / response is receive?</p>
  
  <p>I quess i will wrap external libraries for deflate and encode/decode into factory. And then this factory will be injected somehere? 
  Like $httpBackend ? </p>