Permalink
Browse files

Fix for sync filters running not in Connect-compat mode

  • Loading branch information...
1 parent d46a31e commit 37637b0d7f7fa23b220a09fdb02ade017ca99964 mde committed Nov 6, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/controller/base_controller.js
@@ -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;
}

0 comments on commit 37637b0

Please sign in to comment.