Skip to content

Instantly share code, notes, and snippets.

@threewordphrase
Created September 11, 2016 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threewordphrase/e03f9e2f07bf6c240a7597e3d5d780dd to your computer and use it in GitHub Desktop.
Save threewordphrase/e03f9e2f07bf6c240a7597e3d5d780dd to your computer and use it in GitHub Desktop.
if (EPURA_ENVIRONMENT === 'test'){
angular.module('warehouse').factory('cacheBustInterceptor', function() {
return {
request: function(config) {
if (config.method === 'GET' && config.url.indexOf('/api/') > -1) {
if (config.params === undefined) {
config.params = {};
}
config.params.bust = Math.random().toString(36).replace(/[^a-z]+/g, '');
}
return config;
}
};
}).config(function($httpProvider) {
$httpProvider.interceptors.push('cacheBustInterceptor');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment