Skip to content

Commit

Permalink
Special case /. Closes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Nov 1, 2019
1 parent 173fa48 commit ce0be9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Expand Up @@ -85,9 +85,9 @@ internals.Router.prototype.special = function (type, route) {

internals.Router.prototype.route = function (method, path, hostname) {

const segments = path.split('/').slice(1);
const segments = path.length === 1 ? [''] : path.split('/').slice(1);

const vhost = (this.vhosts && hostname && this.vhosts[hostname]);
const vhost = this.vhosts && hostname && this.vhosts[hostname];
const route = (vhost && this._lookup(path, segments, vhost, method)) ||
this._lookup(path, segments, this.routes, method) ||
(method === 'head' && vhost && this._lookup(path, segments, vhost, 'get')) ||
Expand Down

0 comments on commit ce0be9d

Please sign in to comment.