Tracks @chttp/router Hono-middleware compat. Not yet functional —
see the limitation below.
app.fetch(req, env, ctx): Promise<Response>exists and is callable through the router's normal Node test harness.c.req.urlis populated on the fetch path so middlewares that read it (e.g. hono/logger's inbound<-- METHOD pathline) get a real value.app.use('*', mw)andapp.use('/prefix/*', ...mws)honor Hono's path-scoped middleware shape — see the corresponding router unit tests inpackages/router/test/router.test.js.
The single active test (hono/logger prints the inbound <-- line on a 200 response) covers all three. Two more tests sit behind test.skip
waiting on the follow-up below.
hono/logger (and any other middleware that wants to read the live
response status after await next()) does:
await next()
log(`--> ${method} ${path} ${c.res.status} ${elapsed}ms`)On chttp:
- Node path —
c.resreturns the rawServerResponse, which exposesstatusCode, notstatus. hono/logger throws. - Fetch path —
c.resisnull. hono/logger throws.
So only the inbound <-- ... line ever prints; the outbound
--> ... status elapsed line throws, the response has already been
written by the time the throw surfaces, and the captured stdout ends
with just the inbound.
The follow-up is one of:
- Bridge
c.reson the fetch path to a small Response-shaped record (just{ status, headers }) that scriptc can lower. This is blocked on subset research —Responseas a class field is SC1090, andServerResponse | { status, headers }is SC2009. - Report a scriptc issue if Hono's typing is actually correct and
the chttp type-side just looks wrong to scriptc. The chttp side
could be defensible:
c.resis documented as a Node-shaped escape hatch, and Hono's read ofc.res.statusis a Hono idiom rather than a Web Standards contract.
Once one of those lands, flip the two test.skip entries in
test/logger.test.ts and the integration is fully tracked.
pnpm --filter chttp-example-hono-middleware test