Skip to content

Commit

Permalink
Merge pull request #121 from flatiron/connect-stream
Browse files Browse the repository at this point in the history
[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 1637304
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/director/http/index.js
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1637304

Please sign in to comment.