Skip to content

Commit

Permalink
Merge pull request #45 from algesten/master
Browse files Browse the repository at this point in the history
Only exec path RE when method matches
  • Loading branch information
haoxin committed Dec 28, 2015
2 parents d74d29a + 366957e commit 5c40252
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions index.js
Expand Up @@ -24,12 +24,11 @@ function create(method) {
debug('%s %s -> %s', method || 'ALL', path, re);

return function *(next){
const m = re.exec(this.path)

// method
if (!matches(this, method)) return yield* next;

// path
const m = re.exec(this.path);
if (m) {
const args = m.slice(1).map(decode);
debug('%s %s matches %s %j', this.method, path, this.path, args);
Expand Down

0 comments on commit 5c40252

Please sign in to comment.