Skip to main content

Module routing

Module routing 

Source
Expand description

Path matching and routing utilities.

This module provides path parameter extraction with type converters, similar to FastAPI’s path converters: {id:int}, {value:float}, {uuid:uuid}, {path:path}.

§Trailing Slash Handling

This module also handles trailing slash normalization via TrailingSlashMode:

  • Strict: Exact match required (default)
  • Redirect: 308 redirect to canonical form (no trailing slash)
  • RedirectWithSlash: 308 redirect to form with trailing slash
  • MatchBoth: Accept both forms without redirect

Structs§

ParamInfo
Path parameter information.
RoutePattern
A parsed route pattern.
RouteTable
Simple route table for path matching.
UrlRegistry
Registry for named routes, enabling URL generation.

Enums§

Converter
Path parameter type converter.
PathSegment
A parsed path segment.
RouteLookup
Result of a route lookup.
TrailingSlashMode
Trailing slash handling mode.
UrlError
Error that can occur during URL generation.

Functions§

format_allow_header
Format allowed methods as an HTTP Allow header value.
method_order
Get the sort order for an HTTP method.
url_decode
URL-decode a percent-encoded string.
url_encode
URL-encode a string for use in a query parameter.
url_encode_path_segment
URL-encode a path segment.