Skip to content
Myr

Added publish Request#notFound()

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

authored by visionmedia · committed by visionmedia · parent 4297c10 · Browse files · 2 files+23 added−6 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+23 added−6 removed

  • other:+23 added−6 removed

2 files+23 added−6 removed

modified:lib/express/core.js+2 added-6 removed
3 unmodified lines
4/**5 * Module dependencies.6 */78var showExceptions = require('express/pages/show-exceptions'),9 notFound = require('express/pages/not-found'),10 multipart = require('multipart'),8var multipart = require('multipart'),9 utils = require('express/utils'),10 events = require('events'),11 fs = require('fs')12
103 unmodified lines
116 return this.route()117 }118 return body119 }122 else if (this.request.accepts('html') && set('helpful 404'))123 this.request.halt(404, notFound.render(this.request))120 else125 this.request.halt()121 this.request.notFound()122 },123 124 /**125 * Attempt to match a route from Express.routes.
208 unmodified lines
modified:lib/express/request.js+21 added
4 unmodified lines
5 * Module dependencies.6 */78var showExceptions = require('express/pages/show-exceptions'),9 notFound = require('express/pages/not-found'),10 statusBodies = require('http').STATUS_CODES,11 queryString = require('querystring'),12 mime = require('express/mime'),13 url = require('url')
288 unmodified lines
302 * re-thrown, terminating the process (unless otherwise caught).303 *304 * @param {Error} err305 * @return {Request}306 * @settings 'throw exceptions', 'show exceptions'307 * @api public308 */309 310 error: function(err) {
3 unmodified lines
314 this.halt(500)315 if (set('throw exceptions'))316 throw err317 return this318 },319 320 /**321 * Halt with 404 Not Found.322 *323 * When "html" is accepted, and "helpful 404" is enabled324 * the not-found page will be shown, otherwise the 325 * request will halt with default 404 status body.326 *327 * @return {Request}328 * @api public329 */330 331 notFound: function() {332 if (this.accepts('html') && set('helpful 404'))333 this.halt(404, notFound.render(this))334 else335 this.halt()336 return this337 }338})