Skip to content
Permalink
Browse files

Merge pull request #121 from flatiron/connect-stream

[minor] options.stream can be set instead of setting stream for every route
  • Loading branch information...
indexzero committed Jul 13, 2012
2 parents 72fe125 + ef31edf commit 16373045df33a4f040a9691e3d5a3b41f148a6c4
Showing with 15 additions and 1 deletion.
  1. +15 −1 lib/director/http/index.js
@@ -40,6 +40,20 @@ var Router = exports.Router = function (routes) {
//
util.inherits(Router, director.Router);

//
// ### function configure (options)
// #### @options {Object} **Optional** Options to configure this instance with
// Configures this instance with the specified `options`.
//
Router.prototype.configure = function (options) {
options = options || {};

// useful when using connect's bodyParser
this.stream = options.stream || false;

director.Router.prototype.configure.call(this, options);
}

//
// ### function on (method, path, route)
// #### @method {string} **Optional** Method to use
@@ -113,7 +127,7 @@ Router.prototype.dispatch = function (req, res, callback) {
}

runlist = this.runlist(fns);
stream = runlist.some(function (fn) { return fn.stream === true });
stream = this.stream || runlist.some(function (fn) { return fn.stream === true });

function parseAndInvoke() {
error = self.parse(req);

0 comments on commit 1637304

Please sign in to comment.
You can’t perform that action at this time.