Get route name before munging request

This ought to correct a problem where we incorrectly report route names
for admin routes
This commit is contained in:
Jonathan Lange
2016-06-15 16:06:19 +01:00
parent d7da63a6e4
commit 39c9de8e2a

View File

@@ -30,9 +30,9 @@ func (i Instrument) Wrap(next http.Handler) http.Handler {
begin := time.Now()
isWS := strconv.FormatBool(isWSHandshakeRequest(r))
interceptor := &interceptor{ResponseWriter: w, statusCode: http.StatusOK}
route := i.getRouteName(r)
next.ServeHTTP(interceptor, r)
var (
route = i.getRouteName(r)
status = strconv.Itoa(interceptor.statusCode)
took = time.Since(begin)
)