Skip to content

feat(request): add --trace to show matched routes - #98

Merged
yusukebe merged 3 commits into
nextfrom
feat/trace
Aug 19, 2026
Merged

feat(request): add --trace to show matched routes#98
yusukebe merged 3 commits into
nextfrom
feat/trace

Conversation

@yusukebe

Copy link
Copy Markdown
Member

Add --trace to hono request (idea from Yusuke). The output gets matchedRoutes: every middleware and handler that matched the request, with responded on the one that returned the response. Use it to debug an unexpected response in one command.

Implementation: wrap the app with a tracer middleware and read c.req.matchedRoutes / c.req.routeIndex — Hono's own APIs for this. On a 404 fallthrough the response comes from the notFound handler, so nothing is marked as responded then.

hono request -P /api/users/123 --trace

The author should do the following, if applicable

  • Add tests
  • Run tests
  • pnpm run format:fix && pnpm run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@hono/cli@98

commit: bc68767

@yusukebe
yusukebe merged commit c961633 into next Aug 19, 2026
6 checks passed
@yusukebe
yusukebe deleted the feat/trace branch August 19, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant