Add support to withFormat on Filters (feature request)
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
When developing APIs, filters are a good place to check for preconditions before hitting a controller.
When a resource representation can be xml/json, the errors thrown from a filter when a precondition is not satisfied would be returned in the preferred representation by the client. From controllers that can be easily done using withFormat but it is not available from Filters, so the content negotiation should be hardcoded in the filter.
I would like to put under consideration the addition of withFormat to Filters to make error returning in different representations simpler.
Contributor guide
Research direction
Start by reading the Filters entry point and the controller withFormat behavior to understand how content negotiation is currently exposed. Define equivalent filter behavior for XML and JSON error responses, then add coverage showing that filter failures use the client's preferred representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100