scalatra/scalatra — pull request #434 by nrinaudo (2014-11-11 12:23:29+00:00)
Title: Added support for generic content-encoding / decoding

This commit makes the behaviour of `GZipSupport` more generic, in that:

* request entity bodies encoding with a known content encoding will be automatically decoded.
* requests that ask for a `deflate` content-encoding will honoured.

This fixes #430 (the request's preferred charset is now used) and #431.

Unit tests have been updated to reflect the changes and all tests of the core project still pass.

There are two new classes:

* `ContentEncoding`, where the core of content encoding resides.
* `Conneg`, which implements HTTP content negotiation as per the specs. This might be useful for other features, as all `Accept-XXX` headers behave the same way (charset, encoding, language, range).

There are two things I feel are still necessary:

* rename `GZipSupport` to `ContentEncodingSupport`, but this would break compatibility and documentation.
* use ScalaTest to generate random strings in unit tests rather than the hard-coded `this is the body`.