Skip to content
Myr

View scope now defaults to the request

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

No longer the response, as this is more useful for obtaining urls etc

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent b115ec7 · Browse files · 2 files+3 added−3 removed
This commit

State

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

Diff stats

2 files+3 added−3 removed

  • tests:+2 added−2 removed
  • other:+1 added−1 removed

2 files+3 added−3 removed

modified:lib/express/view.js+1 added-1 removed
213 unmodified lines
214 layout += ext;215 }216217 // Default execution scope to the response218 options.scope = options.scope || this;218 options.scope = options.scope || this.req;219220 // Auto-cache in production221 if (this.app.set('env') === 'production') {222 options.cache = true;
80 unmodified lines
modified:test/view.test.js+2 added-2 removed
180 unmodified lines
181 var app = create();182 app.set('view engine', 'jade');183 184 app.get('/', function(req, res){185 res.internal = '1';186 res.method = function(){185 req.internal = '1';186 req.method = function(){187 return this.internal;188 };189 res.render('scope.jade', { layout: false });190 });
311 unmodified lines