Skip to content

Commit

Permalink
Fix for sync filters running not in Connect-compat mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Nov 6, 2012
1 parent d46a31e commit 37637b0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/controller/base_controller.js
Expand Up @@ -166,15 +166,18 @@ controller.BaseController.prototype = new (function () {

// Create an async wrapper for sync filters
// Connect middleware is async by definition
if (!filter.async && !connectCompat) {
func = function (next) {
filter.def.apply(self, []);
asyncArgs = connectCompat ?
[this.request, this.response] : [];
if (!filter.async) {
func = function () {
var args = Array.prototype.slice.call(arguments)
// Pull off the continuation and run it separately
, next = args.pop();
filter.def.apply(self, args);
next();
};
}
else {
asyncArgs = connectCompat ?
[this.request, this.response] : [];
func = filter.def;
}

Expand Down

0 comments on commit 37637b0

Please sign in to comment.