feat(06-03): add raw groups, house middleware, and route:list

- GroupRaw plus sticky raw inheritance and registration-time house-envelope refusal via pact.HasHouseMiddleware
- Recover on raw routes writes a bare 500; non-raw keeps the house JSON body
- Router.Routes() and surf.RouteListCommand; generated main registers route:list
This commit is contained in:
Jakub Zych
2026-09-19 19:55:32 +02:00
parent 42b8295cc1
commit fa7e6d1870
8 changed files with 391 additions and 22 deletions

30
surf/routetable.go Normal file
View File

@@ -0,0 +1,30 @@
package surf
// RouteInfo is a read-only snapshot of one registered route after Assemble
// or BuildRouter.
type RouteInfo struct {
Method string
Pattern string
PluginID string
Middleware []string
Raw bool
}
// Routes returns a defensive copy of every registered route.
func (r *Router) Routes() []RouteInfo {
if r == nil {
return nil
}
out := make([]RouteInfo, len(r.routes))
for i, rt := range r.routes {
mw := append([]string{}, rt.middleware...)
out[i] = RouteInfo{
Method: rt.method,
Pattern: rt.path,
PluginID: rt.pluginID,
Middleware: mw,
Raw: rt.raw,
}
}
return out
}