Skip to content

Commit

Permalink
Allowing superagent-cache to create it's own superagent singleton if …
Browse files Browse the repository at this point in the history
…one is not provided.
  • Loading branch information
Joseph Lokahi Podwys committed Apr 21, 2015
1 parent dd84f3e commit 22af3ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ SHOULD cache-service STORE/RETURN undefined WHEN KEY IS NOT FOUND?

var cs = require('cache-service').cacheService;

module.exports = function(superagent, config){
module.exports = function(agent, config){

var superagent = (agent) ? agent : require('superagent');
config = config || {};
var Request = superagent.Request;
var props = {doQuery: true, cacheWhenEmpty: true};
Expand Down Expand Up @@ -228,4 +229,8 @@ module.exports = function(superagent, config){

var noop = function(){}

if(!agent){
return superagent;
}

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superagent-cache",
"version": "0.1.11",
"version": "0.1.12",
"description": "Superagent with tiered caching provided by cache-service.",
"main": "index.js",
"dependencies": {
Expand Down

0 comments on commit 22af3ae

Please sign in to comment.