I would like to make parameter parsing in Spray routing case insensitive. For example:
val route: Route = {
(path("search") & get) {
parameters('pagesize.as[Int] ?, 'appId ?) { (pageSize, appId) =>
...
}
}
}
In this route, I would like the pageSize and appId parameters to work as case insensitive. For example, pagesize=5 OR PAGESIZE=5.
Looks like getting query parameters from URI logic is hardcoded in ParamDefMagnet2.filter function.
In order to overcome this limitation, I would duplicate that code, replace logic with
ctx.request.uri.query.find(_._1.equalsIgnoreCase(paramName))
and import it when needed.Example usage would look like this:
And changed implicits would look like this: