Skip to content
Myr

Merge branch 'features/render-status'

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 · parents 74a0673, bb2e24e · Browse files · 4 files+46 added−4 removed
This commit

State

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

Diff stats

4 files+46 added−4 removed

  • tests:+36 added−0 removed
  • other:+10 added−4 removed

4 files+46 added−4 removed

modified:docs/guide.md+2 added
509 unmodified lines
510511 - _context|scope_ Template evaluation context (_this_)512 - _locals_ Object containing local variables513 - _debug_ Output debugging information514 - _status_ Response status code, defaults to 200515 - _headers_ Response headers object516517### res.partial(view[, options])518519Render _view_ partial with the given _options_. This method is always available
200 unmodified lines
modified:examples/pages/app.js+5 added-3 removed
modified:lib/express/view.js+3 added-1 removed
168 unmodified lines
169 *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 {298 self.send(str);300 self.send(str, options.headers, options.status);301 }302};
modified:test/view.test.js+36 added
206 unmodified lines
207 { url: '/custom' },208 { body: '<p>2</p>'});209 },210 211 'test #render() status': function(assert){212 var app = create();213 214 app.get('/', function(req, res){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