RESTinio 0.4.4 Released!

2018.04.05

We happy to announce a minor release of our HTTP/Websocket server library RESTinio 0.4.4.

What's new:

  • Add a concept of data transformators. And implement zlib transformators. Now it is possible to compress responses' bodies and decompress requests' bodies. See details: Compression (defalate, gzip).
    router->http_get(R"(/port/:id/latest)",
        [](auto req, auto params) {
            auto resp = req->create_response();
            resp.append_header_date_field()
                .append_header(restinio::http_field::content_type, "application/json");
            restinio::transforms::zlib::gzip_body_appender(resp)
                .append(load_port_data(params["id"]))
                .complete();
            return resp.done();
        });
    
    router->http_post(R"(/port/:id/data)",
        [](auto req, auto params) {
            return restinio::transforms::zlib::handle_body(*req, [&](auto uncompressed_body) {
                store_port_data(params["id"], upcompressed_body);
                return req->create_response()
                    ...
                    .done();
            });
        });
    
  • Add value_or() helper function for obtaining parameters from RESTinio key-value containers. Before v.0.4.4 it was necessary to write like this:
    const auto count = qp.has("count") ? restinio::cast_to<unsigned>(qp["count"]) : 100u;
    Now it is possible to write like that:
    const auto count = restinio::value_or(qp, "count"100u); 
    See details: Get values from RESTinio key-value containers
  • Switch to https://github.com/martinmoene/string-view-lite for string view (uses standard implementation if available).
  • Use https://github.com/martinmoene/optional-lite for optional (uses standard implementation if available).

RESTinio is hosted on bitbucket (github mirror).

Archive is available in download section.

Documentation with helpful information is here.

If you miss something in RESTinio and want to see some new features let us know via info@stiffstream.com.