Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for sync filters running not in Connect-compat mode

  • Loading branch information...
commit 37637b0d7f7fa23b220a09fdb02ade017ca99964 1 parent d46a31e
mde authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/controller/base_controller.js
View
13 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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.