Created
September 11, 2016 23:20
-
-
Save threewordphrase/e03f9e2f07bf6c240a7597e3d5d780dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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