pathParametersOf function
Reads router-captured path parameters from request.
Returns an empty map when the request did not pass through a router, which keeps extractors testable without mounting one.
Implementation
Map<String, String> pathParametersOf(Request request) {
final raw = request.context[pathParametersKey];
if (raw is Map<String, String>) return raw;
if (raw is Map) return raw.map((k, v) => MapEntry('$k', '$v'));
return const {};
}