Skip to content
Myr

Added routeProvides()

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

authored by visionmedia · committed by visionmedia · parent e5acdb3 · Browse files · 1 file+7 added−7 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+7 added−7 removed

  • other:+7 added−7 removed

1 file+7 added−7 removed

modified:lib/express.core.js+7 added-7 removed
266 unmodified lines
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 true271 if (!route.options.provides) return true272 if (route.options.provides.constructor != Array) 273 route.options.provides = [route.options.provides]274 for (i = 0, len = route.options.provides.length; i < len; ++i)275 if (request.headers['Accept'].match(route.options.provides[i]))276 return true277 return false278 },279 280 /**281 * Attept to match and call a route for
111 unmodified lines