Skip to content

7.2.1

Choose a tag to compare

@rennf93 rennf93 released this 01 Jul 08:11
· 29 commits to master since this release
038e76e

Per-route config resolves on parameterised and included routes (v7.2.1)

  • Fixed — Per-route decorator config now resolves on routes with path parameters and routes added via include_router. SecurityMiddleware is a BaseHTTPMiddleware, so it runs before the router and scope["route"] is unset; it resolved the active route by exact-path string comparison (r.path == request.url.path), which never matches a templated path like /items/{id}. As a result every per-route decorator (rate_limit, max_request_size, content_type_filter, custom_validation, detection_exclusion, suspicious_detection, behavioral rules, …) silently did nothing on parameterised or router-included routes. Route resolution now replicates Starlette's own route.matches(scope) matching, so per-route config fires on those routes too. Static, non-parameterised routes are unaffected.

What's Changed

  • fix(middleware): resolve per-route config on parameterised and included routes by @rennf93 in #99

Full Changelog: 7.2.0...7.2.1