@trayio/threadneedle
Advanced tools
Comparing version 1.0.1 to 1.0.2
/* | ||
* Run the global `before`/`beforeRequest` method, and then the local method. | ||
* Run the global `before` method, and then the local method. | ||
* | ||
@@ -12,3 +12,3 @@ * Note that this is most often used to set/update parameters in the `params` | ||
module.exports = function (before, arg) { | ||
module.exports = function (before, params) { | ||
var threadneedle = this; | ||
@@ -22,3 +22,3 @@ return when.promise(function (resolve, reject) { | ||
if (_.isFunction(threadneedle._globalOptions.before)) { | ||
return when(threadneedle._globalOptions.before(arg)); | ||
return when(threadneedle._globalOptions.before(params)); | ||
} | ||
@@ -30,3 +30,3 @@ }) | ||
if (_.isFunction(before)) { | ||
return when(before(arg)); | ||
return when(before(params)); | ||
} | ||
@@ -36,3 +36,3 @@ }) | ||
.then(function () { | ||
return arg; | ||
return params; | ||
}) | ||
@@ -39,0 +39,0 @@ |
@@ -5,2 +5,3 @@ module.exports = { | ||
before: require('./before'), | ||
beforeRequest: require('./beforeRequest'), | ||
expects: require('./expects'), | ||
@@ -7,0 +8,0 @@ notExpects: require('./notExpects'), |
@@ -83,3 +83,3 @@ var when = require('when'); | ||
.then(function (request) { | ||
return globalize.before.call(threadneedle, config.beforeRequest, request); | ||
return globalize.beforeRequest.call(threadneedle, config.beforeRequest, request); | ||
}) | ||
@@ -101,3 +101,2 @@ | ||
// Validate `expects` | ||
// var expects = normalizeExpects(config.expects); | ||
var expects = globalize.expects.call(threadneedle, config.expects); | ||
@@ -110,4 +109,3 @@ validationError = validateExpects(res, expects); | ||
// Validate `notExpects` | ||
// var notExpects = normalizeExpects(config.notExpects); | ||
var notExpects = globalize.expects.call(threadneedle, config.notExpects); | ||
var notExpects = globalize.notExpects.call(threadneedle, config.notExpects); | ||
validationError = validateNotExpects(res, notExpects); | ||
@@ -114,0 +112,0 @@ if (validationError) { |
{ | ||
"name": "@trayio/threadneedle", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A framework for simplifying working with HTTP-based APIs.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
74514
32
1843