I wanted to make my URL Case Insensitive, including the query string parameters. I currently use ModelAttribute to bind request params to my model.
I have googled about this a lot in the past couple of days and the only viable solution that I could find was to use a Custom Filter and use RequestParams to bind the values. Here is the best I could find so far, http://stackoverflow.com/a/29533456/3131696 but this doesn't support case insensitive matching.
As the Web API is built on top of HTTP, I would like to confirm to the URL standards and make my query parameters case insensitive.
Can this be made available ?
Note: There was another similar request #17876, but the fix only work for Path parameters, this request is to extend that to Query parameters as well.
Consider what binding the request to a target object means: for each request parameter check through reflection if the target object has a matching property. There is no easy way to do this in a case insensitive manner through the PropertyAccessor we use internally.
You might have to create an object for accepting web input with lowercase field names, as suggested in the SO thread. Then you can predictably turn query params to lower-case. I'm wondering is this really worth it? Is case insensitive that important for query parameters, is anyone typing them in, or are they sent by programatic clients?
Why is it such a great concern though especially for the rare occasion? What's wrong with a 400 error that explains what parameter is missing or is misspelled? Sure we could spend some effort to make that possible but I just don't see a strong motivation for it.
If you really want it, you could even today, create a command object with lowercase field names combined with a Filter that decorates the request and returns lowercase request parameter names (as suggested in the SO thread). Or perhaps using "_" to separate multi-word query parameters combined with a Filter that turns those to camelback notation.