Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ app.render = function render(name, options, callback) {
if (typeof options === 'function') {
done = options;
opts = {};
} else if (options == null) {
opts = {};
}

// merge options
Expand Down
18 changes: 18 additions & 0 deletions test/app.render.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,24 @@ describe('app', function(){
})
})

it('should accept null or undefined options', function (done) {
var app = createApp()

app.set('views', path.join(__dirname, 'fixtures'))
app.locals.user = { name: 'tobi' }

app.render('user.tmpl', null, function (err, str) {
if (err) return done(err);
assert.strictEqual(str, '<p>tobi</p>')

app.render('user.tmpl', undefined, function (err2, str2) {
if (err2) return done(err2);
assert.strictEqual(str2, '<p>tobi</p>')
done()
})
})
})

describe('caching', function(){
it('should cache with cache option', function(done){
var app = express();
Expand Down