Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
Remove trailing slashes in express middleware.
Browse files Browse the repository at this point in the history
Fixes #29.
  • Loading branch information
msiebuhr committed Jul 19, 2013
1 parent e6a86df commit ff86b04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/helpers/getExpressMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ function factory(parentClient) {
routeName = req.method + '_' + routeName;
}

// Get rid of : in route names, remove first /, and replace
// rest with _.
routeName = 'response_time.' + routeName.replace(/:/g, "").replace(/\//, "").replace(/\//g, "_"),
// Get rid of : in route names, remove first and last /,
// and replace rest with _.
routeName = 'response_time.' + routeName.replace(/:/g, "").replace(/^\/|\/$/g, "").replace(/\//g, "_");
client.timing(routeName, startTime);
} else {
client.timing('response_time', startTime);
Expand Down

0 comments on commit ff86b04

Please sign in to comment.