superagent-defaults
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -5,3 +5,3 @@ { | ||
"description": "Create some defaults for superagent requests", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"keywords": [], | ||
@@ -8,0 +8,0 @@ "dependencies": { |
@@ -26,4 +26,4 @@ /** | ||
} | ||
var proto = Context.prototype = {}; | ||
// setup methods for context | ||
@@ -35,3 +35,3 @@ | ||
Context.prototype[method] = function() { | ||
proto[method] = function() { | ||
this.stack.push({ | ||
@@ -52,3 +52,3 @@ method: method, | ||
Context.prototype.applyStack = function(req) { | ||
proto.applyStack = function(req) { | ||
this.stack.forEach(function(operation) { | ||
@@ -62,14 +62,10 @@ req[operation.method].apply(req, operation.args); | ||
each(methods, function(method) { | ||
var name = 'delete' == method ? 'del' : method; | ||
var targetMethod = method == 'delete' ? 'del' : method; | ||
var httpMethod = method.toUpperCase(); | ||
proto[method] = function(url, fn) { | ||
var r = this.request; | ||
var req = r instanceof Function ? | ||
r(httpMethod, url) : | ||
r[targetMethod](url); | ||
method = method.toUpperCase(); | ||
Context.prototype[name] = function(url, fn) { | ||
var req; | ||
if (this.request instanceof Function) { | ||
req = this.request(method, url); | ||
} else { | ||
req = this.request[method.toLowerCase()](url); | ||
} | ||
// Do the attaching here | ||
@@ -86,2 +82,4 @@ this.applyStack(req); | ||
proto.del = proto['delete']; | ||
/** | ||
@@ -88,0 +86,0 @@ * Iterate array-ish. |
{ | ||
"name": "superagent-defaults", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "Create some defaults for superagent requests", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6109