From ad3202563d397f275f8875b37136d39ed5d4b703 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Tue, 8 Sep 2026 22:31:13 +0900 Subject: [PATCH] fix(trace): use matchedRoutes from hono/route --- src/commands/request/trace.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/request/trace.ts b/src/commands/request/trace.ts index 5cb4016..afdf17e 100644 --- a/src/commands/request/trace.ts +++ b/src/commands/request/trace.ts @@ -1,5 +1,6 @@ import { Hono } from 'hono' import type { MiddlewareHandler } from 'hono' +import { matchedRoutes } from 'hono/route' import type { RouterRoute } from 'hono/types' import { findTargetHandler, isMiddleware } from 'hono/utils/handler' @@ -26,7 +27,8 @@ export const withTracer = (app: Hono): { app: Hono; getTrace: () => TraceEntry[] let matched: Matched | undefined const tracer: MiddlewareHandler = async (c, next) => { await next() - matched = { routes: c.req.matchedRoutes, index: c.req.routeIndex, status: c.res.status } + // matchedRoutes(c) from hono/route: c.req.matchedRoutes is deprecated + matched = { routes: matchedRoutes(c), index: c.req.routeIndex, status: c.res.status } } const wrapper = new Hono() wrapper.use(tracer)