valum-framework / valum

Web micro-framework written in Vala
https://valum-framework.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
226 stars 23 forks source link

Middleware to decode encoding and charset #156

Closed arteymix closed 8 years ago

arteymix commented 8 years ago

Two really useful middlewares to decode applied encoding and content charset.

It will require some documentation and tests. The logic is quite tricky, especially for decode as remaining encodings are reversed back in the headers.

I couldn't find anything more appropriate than 501 Not Implemented to indicate the lack of support for an encoding or charset.

The typical use case is on the top of an app or for an upload processing:

app.use (decode ()));

app.post ("document", decode ())
    .then ((req, res) => {
        var doc = req.flatten_bytes ();
    });

The squash integration must be opt-in with fallback on the basic converters.

arteymix commented 8 years ago

Looks good to me.

Two things: