/*
This function is needed to (1) keep backwards compatibility with
possibly-broken programs sending requests without the appropriate
Content-Type header (and so req.body won't have the parameters sent
in the request), while at the same time (2) not issuing a warning
due to the use of req.bodyParams, not deprecated.
function readBodyParams(req) {
    if (req.headers['content-type'] !== 'application/x-www-form-urlencoded') {
        deprecationWarning(
            "make sure you correctly set Content-Type to" +
                " application/x-www-form-urlencoded"
        );

        try {
            return qs.parse(req.rawBody.toString());
        } catch(e) {
            return null;
        }
    }

    return req.body;
}