refactor($http): move checking of the xsrf tokens to after cache check in $http

The pull request moves a place in the code where xsrf tokens are set to after the cache is checked, this way hopefully improving performance.

This is referenced in issue #7717.