/**
 * Request enhance middleware.
 * @function serverside.middleware.defineReqEnhanceMiddleware
 * @param {object} context - Server context object.
 * @param {object} context.requestEnhanceFunctions - Enhance modules. Keys are enhance name, values are functions.
 * @returns {function} - A req enhance middleware.
 * @author Taka Okunishi
 *
 */
var _enhanceObject = require('./_enhance_object');
exports = module.exports = function (context) {
    context.assertKeys(['requestEnhanceFunctions']);

    var enhanceFunctions = context.requestEnhanceFunctions;
    return function (req, res, next) {
        _enhanceObject(req, enhanceFunctions);
        next();
    };
};