Skip to content

Commit

Permalink
Checks for IE internally, and appends timestamps to requests if appro…
Browse files Browse the repository at this point in the history
…priate
  • Loading branch information
johntron committed Sep 12, 2014
1 parent 1538f7b commit 3e05e7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions component.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"description": "Plugin for visionmedia/superagent that adds headers to all requests that prevents caching",
"version": "0.0.1",
"keywords": [],
"dependencies": {},
"dependencies": {
"component/ie": "0.0.1"
},
"development": {},
"license": "MIT",
"main": "index.js",
"scripts": [
"index.js"
]
}
}
18 changes: 13 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
var ie = require('ie');

function with_query_strings(request) {
request._query = [Date.now().toString()]
return request;
}

module.exports = function (request) {
request.set('X-Requested-With', 'XMLHttpRequest');
request.set('Cache-Control', 'no-cache,no-store,must-revalidate,max-age=-1');

if (ie) {
with_query_strings(request);
}

return request;
}
module.exports.with_query_strings = function(request) {
request._query = [Date.now().toString()]
return module.exports(request);
};
};

0 comments on commit 3e05e7f

Please sign in to comment.