Skip to content
Myr

Request#halt() accepts callback function as 3rd/4th arg

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

authored by visionmedia · committed by visionmedia · parent 7591834 · Browse files · 2 files+10 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+10 added−2 removed

  • other:+10 added−2 removed

2 files+10 added−2 removed

modified:lib/express/core.js+1 added-1 removed
288 unmodified lines
289 try {290 if (err) throw err291 if (request.response.finished) return292 if (typeof (body = (new Router(request)).route()) === 'string')293 request.halt(200, body, null, function(err){293 request.halt(200, body, function(err){294 if (err) Express.error(err, request, response)295 }) 296 } catch (err) {297 Express.error(err, request, response)
58 unmodified lines
modified:lib/express/request.js+9 added-1 removed
144 unmodified lines
145 return this146 },147 148 /**149 * Immediately respond with response _code_, _body_ and optional _encoding_.149 * Immediately respond with response _code_, _body_.150 *151 * The status _code_ defaults to to 404, and _body_ will152 * default to the default body associated with the response153 * _code_.154 *155 * Optionally an _encoding_ may be passed, followed by156 * a _callback_ function.157 *158 * @param {int} code159 * @param {string} body160 * @param {string} encoding161 * @param {function} callback162 * @see statusBodies163 * @api public164 */165166 halt: function(code, body, encoding, callback) {167 if (encoding instanceof Function)168 callback = encoding,169 encoding = null170 this.status(code = code || 404)171 if (body = body || statusBodies[code])172 return this.respond(body, encoding, callback)173 },
118 unmodified lines