let config = require('../config');
module.exports = function(req, res, next) {
	const validFormats = ['html', 'json'];
	req.responseFormat = function() {
		let format = null;
		if(req.query && req.query.responseFormat) {
			format = req.query.responseFormat.toString().toLowerCase();
		}
		if(!validFormats.includes(format)) {
			format = config.webserver.response.defaultFormat;
		}
		return format;
	};
	next();
};
let config = require('../config');
module.exports = function(req, res, next) {
	const validFormats = ['html', 'json'];
	req.responseFormat = function() {
		let format = null;
		if(req.query && req.query.responseFormat) {
			format = req.query.responseFormat.toString().toLowerCase();
		}
		if(validFormats.indexOf(format) === -1) {
			format = config.webserver.response.defaultFormat;
		}
		return format;
	};
	next();
};
Change .includes to .indexOf for node 5.10 support
Change .includes to .indexOf for node 5.10 support
