function formatTodo(req, res, body, cb) {
    if (body instanceof Error) {
        res.statusCode = body.statusCode || 500;
        body = body.message;
    } else if (typeof body === 'object') {
        body = body.task || JSON.stringify(body);
    } else {
        body = body.toString();
    }

    res.setHeader('Content-Length', Buffer.byteLength(body));
    return cb(null, body);
}
This is a nonsensical custom content-type 'application/todo', just to
demonstrate how to support additional content-types.  Really this is
the same as text/plain, where we pick out 'task' if available