diff --git a/CHANGELOG.md b/CHANGELOG.md index 333a303e3b..d17ce560c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,11 @@ * [#2360](https://github.com/ruby-grape/grape/pull/2360): Reduce gem size by removing specs - [@ericproulx](https://github.com/ericproulx). * [#2361](https://github.com/ruby-grape/grape/pull/2361): Remove `Rack::Auth::Digest` - [@ninoseki](https://github.com/ninoseki). * Your contribution here. - + #### Fixes * [#2364](https://github.com/ruby-grape/grape/pull/2364): Add missing requires - [@ericproulx](https://github.com/ericproulx). -* [#2366](https://github.com/ruby-grape/grape/pull/2366): Quality arguments to `accept` header should default to 1.0 - [@hiddewie](https://github.com/hiddewie). +* [#2366](https://github.com/ruby-grape/grape/pull/2366): Default quality to 1.0 in the `Accept` header when omitted - [@hiddewie](https://github.com/hiddewie). * Your contribution here. ### 1.8.0 (2023/08/30) diff --git a/README.md b/README.md index f0d66f8094..e1d1295afe 100644 --- a/README.md +++ b/README.md @@ -596,6 +596,10 @@ When an invalid `Accept` header is supplied, a `406 Not Acceptable` error is ret option is set to `false`. Otherwise a `404 Not Found` error is returned by Rack if no other route matches. +Grape will evaluate the relative quality preference included in Accept headers and default to a quality of 1.0 when omitted. In the following example a Grape API that supports XML and JSON in that order will return JSON: + + curl -H "Accept: text/xml;q=0.8, application/json;q=0.9" localhost:1234/resource + ### Accept-Version Header ```ruby @@ -1600,7 +1604,7 @@ Note endless ranges are also supported with ActiveSupport >= 6.0, but they requi ```ruby params do requires :minimum, type: Integer, values: 10.. - optional :maximum, type: Integer, values: ..10 + optional :maximum, type: Integer, values: ..10 end ```