Skip to content
Myr

Added replacement for dynamic locals. Closes #788

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 0f6ad43 · Browse files · 1 file+33 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+33 added−13 removed

  • other:+33 added−13 removed

1 file+33 added−13 removed

modified:lib/response.js+33 added-13 removed
508 unmodified lines
509 if ('function' == typeof options) {510 fn = options, options = {};511 }512513 function render() {513 // merge res.locals514 options.locals = this.locals;514 // merge res.locals515 options.locals = self.locals;516516 // status option517 if (options.status) this.statusCode = options.status;517 // status option518 if (options.status) self.statusCode = options.status;519519 // charset option520 if (options.charset) this.charset = options.charset;520 // charset option521 if (options.charset) self.charset = options.charset;522522 // default callback to respond523 fn = fn || function(err, str){524 if (err) return req.next(err);525 self.send(str);526 };523 // default callback to respond524 fn = fn || function(err, str){525 if (err) return req.next(err);526 self.send(str);527 };528528 // render529 app.render(view, options, fn);529 // render530 app.render(view, options, fn);531 }532533 // invoke view callbacks534 var callbacks = app.viewCallbacks535 , pending = callbacks.length536 , len = pending537 , done;538539 for (var i = 0; i < len; ++i) {540 callbacks[i](req, self, function(err){541 if (err) {542 req.next(err);543 done = true;544 return;545 }546547 --pending || render();548 });549 }550};