HTTP Routing Enhancements
summary
Go 1.22 extends http.ServeMux with methods and path wildcards, adds a request.PathValue accessor, supports trailing ... to match the rest of a path and a {$} marker to require a literal trailing slash, and treats HEAD as equivalent to GET. Precedence uses semantic set inclusion: a pattern that matches a strict subset wins; overlapping patterns cause a registration panic with a concrete conflicting string. Conflict checks run pairwise in linear time and use a literal-position index to avoid pathological O(n^2) behavior; the new implementation aims to be roughly as fast as the old one while remaining mostly backward compatible.
AI-written summary · about
chapters (9)
- 0:00HTTP routing enhancements
- 5:17Routing precedence and conflicts
- 9:10Subset precedence rule
- 13:03Regex routing semantics
- 15:51HTTP routing performance
- 18:21Conflict detection in routing
- 20:13Pattern indexing for registration
- 22:00Backwards compatibility
- 23:43Routing features coverage
related talks
17mModern Routing
55m“Using Functional Programming Patterns..."
26mModern HTTP Routing
26mVue-router and its techniques
25mHow I Write HTTP Web Services After 8 Years
12mLightning Talk: Access Control and URI Path Normalization
28mHTTP through Functional Programming
15mRemix Flat Routes – An Evolution in Routing
