diff --git a/lib/PathMapper.js b/lib/PathMapper.js index 1fba67b..493b97a 100644 --- a/lib/PathMapper.js +++ b/lib/PathMapper.js @@ -19,6 +19,14 @@ clone = function (object) { return JSON.parse(JSON.stringify(object)); }; +var cacheBuster = function (id) { + if (id.indexOf('stub_id') > -1) { + return ''; + } else { + return '&h=' + Math.round(Math.random() * 10000000000); + } +}; + /* This has to exist because the API handles date strings incorrectly ✌.ʕʘ‿ʘʔ.✌ * The API needs the time zone to be zulu time, but won't accept '+00:00'. It needs 'Z' */ getApiDateStringForDateTime = function (dateTime) { @@ -59,7 +67,7 @@ module.exports = PathMapper; PathMapper.prototype.getContentPathFor = function (id) { var paths = this.paths; return PROTOCOL_PREFIX + paths.apiDomain + paths.item + id + - API_KEY_FIRST_PARAM + this.apiKey + this.features; + API_KEY_FIRST_PARAM + this.apiKey + this.features + cacheBuster(id); }; PathMapper.prototype.getPagePathFor = function (id) { diff --git a/package.json b/package.json index 0014c23..76868cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ft-api-client", - "version": "2.0.7", + "version": "2.0.8", "repository": { "type": "git", "url": "https://github.com/Financial-Times/ft-api-client.git"