Skip to content
Myr

Revert "fix behavior of multiple app.VERB for the same path"

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

This reverts commit 31b2e2d7b4774eed16a93f9a8a20a9967e91e524. fixes #2133

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 4e12a72 · Browse files · 3 files+14 added−57 removed
This commit

State

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

Diff stats

3 files+14 added−57 removed

  • tests:+1 added−22 removed
  • other:+13 added−35 removed

3 files+14 added−57 removed

modified:lib/application.js+7 added-35 removed
29 unmodified lines
30 * @api private31 */3233app.init = function(){34 this._baseRoutes = {};34 this.cache = {};35 this.settings = {};36 this.engines = {};37 this.defaultConfiguration();
368 unmodified lines
406 */407408methods.forEach(function(method){409 app[method] = function(path){411 if (method === 'get' && arguments.length === 1) {412 return this.set(path);413 }410 if ('get' == method && 1 == arguments.length) return this.set(path);411412 this.lazyrouter();413415 var route = this._baseRoute(path);414 var route = this._router.route(path);415 route[method].apply(route, [].slice.call(arguments, 1));416 return this;417 };418});
8 unmodified lines
427 * @api public428 */429430app.all = function(path){431 this.lazyrouter();432432 var route = this._baseRoute(path);433 var route = this._router.route(path);434 var args = [].slice.call(arguments, 1);435 methods.forEach(function(method){436 route[method].apply(route, args);437 });
100 unmodified lines
538app.listen = function(){539 var server = http.createServer(this);540 return server.listen.apply(server, arguments);541};541542/**543 * Get or create a new base route for path.544 *545 * @param {String} path546 * @return {Route}547 * @api private548 */549550app._baseRoute = function(path){551 this.lazyrouter();552553 var key = typeof path !== 'string'554 ? 'o:' + String(path)555 : 's:' + path;556557 if (path.ignoreCase || !this._router.caseSensitive) {558 key = 'i' + key.toLowerCase();559 }560561 var route = this._baseRoutes[key];562563 if (!route) {564 route = this._router.route(path);565 this._baseRoutes[key] = route;566 }567568 return route;569};
modified:test/app.head.js+1 added-22 removed
modified:History.md+6 added
1unreleased2==========34 * revert "fix behavior of multiple `app.VERB` for the same path"5 - this caused a regression in the order of route execution674.3.0 / 2014-05-218==================910 * add `req.baseUrl` to access the path stripped from `req.url` in routes
1461 unmodified lines