Skip to content
Myr

Started preconditions

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

authored by visionmedia · committed by visionmedia · parent 6e40c71 · Browse files · 1 file+19 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

1 file+19 added−2 removed

  • other:+19 added−2 removed

1 file+19 added−2 removed

modified:lib/express.core.js+19 added-2 removed
261 unmodified lines
262 argsArray : function(args, offset) {263 return Array.prototype.slice.call(args, offset)264 },265 266 routeMethod : function(route, request) {267 return route.method.toUpperCase() == request.method268 },269 270 routeProvides : function(route, request) {271 if (!route.provides) return true272 if (route.provides.constructor != Array) route.provides = [route.provides]273 var accept = request.headers['Accept'].split(/;|,/)274 for (i = 0, len = accept.length; i < len; ++i)275 for (j = 0, len = route.provides.length; j < len; ++j)276 if (route.provides[j] == accept[i])277 return true278 },279 280 /**281 * Attept to match and call a route for 282 * the given _request_, returning the data283 * returned by the route callback.
34 unmodified lines
318 * @api public319 */320 321 routeMatches : function(route, request) {308 if (route.method.toUpperCase() != request.method) return false322 var conditions = [Express.routeMethod, Express.routeProvides]323 for (i = 0, len = conditions.length; i < len; ++i)324 if (!conditions[i](route, request))325 return false326 switch (route.path.constructor) {327 case String: return route.path == request.uri.path328 case RegExp: return !! (Express.captures = request.uri.path.match(route.path))329 }
46 unmodified lines
376 p(request.headers['Cookie'])377 return param('operation') + 'ing ' + param('name')378})379363get('articles', { provides : 'text/html' }, function(){380get('articles', function(){381 return 'list of articles'382})383384get(/articles\/(\d+)/, function(){
8 unmodified lines