intridea/grape — pull request #339 by dieb (2013-02-18 12:08:56+00:00)
Title: Allow rack/mount cascading to be skipped on header

When using header versioning with the :strict policy, Grape currently returns the appropriate error (406 Not Acceptable) but it also returns a X-Cascade header indicating to rack it should keep looking for other routes.

While this behavior is expected for various applications, some may need to skip the cascading and explicitly return the error to the requester.

For that, a :cascade option was added to the version method. The default value is true (keeping backwards compat), meaning that 406 errors shall be raised along with X-Cascade headers, just like before. Though, if set to false, it 406 errors shall be raised with no X-Cascade headers, therefore telling the router it should not lookup other routes.