Say I have an endpoint that accepts requests as follows:
GET https://my.website.com/products?expired
OR
GET https://my.website.com/products
The method I would expect to work:
@GetMapping
public List<Product> products(@RequestParam(value = "expired", required=false) boolean expired) {
//Implementation details
}
This however, will return a Bad Request 400 response.
I know I would get this to work by sending the expired requestParam as expired=true, but I'd like for this to work similar to HTML boolean attributes where the mere presence of a request param represents true and its absence represents false