Skip to content

Release v0.2.26

Choose a tag to compare

@github-actions github-actions released this 16 Apr 22:15
ab0d5b8
feat: make Router.Route() idempotent on duplicate patterns

Calling r.Route(pattern, ...) twice on the same parent now attaches the
second block to the existing chi sub-mux via an isolated chi.Group
instead of panicking. This enables the common pattern of splitting
routes for a resource across blocks with different middleware scopes
(e.g. read vs. write API key scopes).

Each block runs inside its own chi.Group, so Use() inside a block only
applies to that block's handlers. Group() now shares its parent's
subroutes map so nested Route() calls dedup correctly across sibling
blocks.

Signed-off-by: Ahmed Kamal <ahmed@ahmedkamal.io>