What is the correct way to fail when the user provides a wrong or not applicable value for a query parameter?
- with a HTTP 406 Not Acceptable status code and a page describing the issue
- with a HTTP 400 Bad Request status code and a page describing the issue
- a page with no special HTTP status code but giving possible solutions to the issue
Example of not applicable query parameters would be a
order=123 where either
order=asc are expected to decide how to print a list. Giving a non-date value to a parameter that expects a formatted date could be another example.
Normally, sites would simply act as if the default value was given, but this could be a problem if someone links to my site with a wrong query parameter value and search engines start indexing it.