Skip to content
Myr

add pass support

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

authored by Aaron Heckmann · committed by visionmedia · parent c429e88 · Browse files · 2 files+32 added−8 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+32 added−8 removed

  • other:+32 added−8 removed

2 files+32 added−8 removed

modified:lib/express/core.js+22 added-8 removed
102 unmodified lines
103 * @return {mixed}104 * @api private105 */106 107 route: function(){108 var route = this.matchingRoute()109 if (route)110 return route.fn.apply(this.request, this.request.captures.slice(1))107 route: function() { 108 var route = this.matchingRoute(), body109 if (route) {110 body = route.fn.apply(this.request, this.request.captures.slice(1));111 if (this.request.passed) {112 this.request.passed = false113 return this.route()114 }115 return body;116 }117 else if (this.request.accepts('html') && set('helpful 404'))118 this.request.halt(404, require('express/pages/not-found').render(this.request))119 else120 this.request.halt()
5 unmodified lines
126 * @return {Route}127 * @api private128 */129 124 matchingRoute: function(){125 return Express.routes.find(function(route){126 return this.match(route)127 }, this)130 matchingRoute: function() {131 // Stop at the first match. If request.pass() was called132 // continue from where we left off 133 var i = -1134 this.matchingRoute = function() {135 var routes = Express.routes, route136 while (route = routes[++i]) 137 if (this.match(route))138 break139 return route140 }141 return this.matchingRoute() 142 },143 144 /**145 * Check if _route_ matches the current request.
203 unmodified lines
modified:lib/express/request.js+10 added
177 unmodified lines
178 });179 },180 181 /**182 * Pass control to the next matching route.183 *184 * @api public185 */186 187 pass: function () {188 this.passed = true189 },190 191 /**192 * Set Content-Type header to the mime type193 * for the given _path_, which calls mime.type().194 *195 * @param {string} path
86 unmodified lines