Skip to content
Myr

Added render() headers option

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 7ef8f53 · Browse files · 2 files+27 added−2 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+27 added−2 removed

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

2 files+27 added−2 removed

modified:lib/express/view.js+2 added-1 removed
169 unmodified lines
170 * - `context|scope` Template evaluation context (`this`)171 * - `locals` Object containing local variables172 * - `debug` Output debugging information173 * - `status` Response status code, defaults to 200174 * - `headers` Response headers object175 *176 * @param {String} view177 * @param {Object|Function} options or callback function178 * @param {Function} fn
117 unmodified lines
296 return str;297 } else if (fn) {298 fn(null, str);299 } else {299 self.send(str, {}, options.status);300 self.send(str, options.headers, options.status);301 }302};
modified:test/view.test.js+25 added-1 removed
210 unmodified lines
211 'test #render() status': function(assert){212 var app = create();213 214 app.get('/', function(req, res){215 res.render('hello.jade', { layout: false, status: 404 });215 res.render('hello.jade', {216 layout: false,217 status: 404218 });219 });220 221 assert.response(app,222 { url: '/' },223 { body: '<p>:(</p>', status: 404 });224 },225 226 'test #render() headers': function(assert){227 var app = create();228 229 app.get('/', function(req, res){230 res.render('hello.jade', {231 layout: false,232 status: 500,233 headers: {234 'X-Foo': 'bar'235 }236 });237 });238 239 assert.response(app,240 { url: '/' },241 { body: '<p>:(</p>', status: 500, headers: {242 'X-Foo': 'bar',243 'Content-Type': 'text/html; charset=utf-8'244 }});245 },246 247 'test #render() view helpers': function(assert){248 var app = create();249250 app.helpers({
244 unmodified lines