Skip to content

Commit db862d5

Browse files
author
Tauseef Jamadar
committed
Adding ability to store request method along with the route entries
1 parent 9490f8c commit db862d5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/entry.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ var utils = require('./utils');
1212
*
1313
* @api private
1414
*/
15-
function Entry(controller, action, pattern) {
15+
function Entry(controller, action, pattern, method) {
1616
this.controller = controller;
1717
this.action = action;
1818
this.pattern = pattern;
19+
this.method = method;
1920
// TODO: Implement support for 'sensitive' and 'strict' options
2021
utils.pathRegexp(pattern, this.keys = []);
2122
}

lib/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ Router.prototype._route = function(method, pattern, controller, action, helper)
543543
// action. When building paths and URLs, routes declared first take priority.
544544
// Therefore, if there is already an entry for this controller action in the
545545
// table, don't overwrite it.
546-
var entry = new Entry(controller, action, pattern);
546+
var entry = new Entry(controller, action, pattern, method);
547547
var key = entry.key();
548548
if (!this._entries[key]) {
549549
this._entries[key] = entry;

0 commit comments

Comments
 (0)