<commit_before>var xml2json = require('xml2json');
var et = require('elementtree');

function CorsaRequest(req)
{
	this.req = req;
	this.etree = null;
}

/**
 * Export for Node
 *
 * @param req
 * @returns {CorsaRequest}
 */
module.exports = function (req)
{
	return new CorsaRequest(req)
};

/**
 * Returns single header from Request
 *
 * @param header
 * @returns {*}
 */
CorsaRequest.prototype.getHeader = function (header)
{
	if (header == undefined) {
		return null;
	}
	return this.req.get(header);
};


/**
 * Returns raw body of request message
 *
 * @returns {*}
 */
CorsaRequest.prototype.getBody = function ()
{
	if (this.req.rawBody == undefined || this.req.rawBody == "") {
		return null;
	}
	return this.req.rawBody
};


/**
 * Return all headers
 *
 * @returns {headers|*|headers|headers|headers|headers}
 */
CorsaRequest.prototype.getHeaders = function ()
{
	return this.req.headers;
};

/**
 * Returns single Query param
 *
 * @param param
 * @returns {*}
 */
CorsaRequest.prototype.getQueryParam = function (param)
{
	if (param == undefined || this.req.query.param == undefined) {
		return null;
	}

	return this.req.query.param
};


/**
 * Returns all Query Params
 *
 * @returns {*}
 */
CorsaRequest.prototype.getQueryParams = function ()
{
	if (Object.keys(this.req.query).length < 1) {
		return null
	}
	return this.req.query;
};

/**
 * Returns all Post Params
 *
 * @returns {*}
 */
CorsaRequest.prototype.getPostParams = function ()
{
	if (this.req.postData == undefined) {
		return null
	}
	return this.req.postData;
};

/**
 * Returns requested postParam
 *
 * @param param
 * @returns {*}
 */
CorsaRequest.prototype.getPostParam = function (param)
{<commit_msg>Fixing issue with undefined Query params<commit_after>var xml2json = require('xml2json');
var et = require('elementtree');

function CorsaRequest(req)
{
	this.req = req;
	this.etree = null;
}

/**
 * Export for Node
 *
 * @param req
 * @returns {CorsaRequest}
 */
module.exports = function (req)
{
	return new CorsaRequest(req)
};

/**
 * Returns single header from Request
 *
 * @param header
 * @returns {*}
 */
CorsaRequest.prototype.getHeader = function (header)
{
	if (header == undefined) {
		return null;
	}
	return this.req.get(header);
};


/**
 * Returns raw body of request message
 *
 * @returns {*}
 */
CorsaRequest.prototype.getBody = function ()
{
	if (this.req.rawBody == undefined || this.req.rawBody == "") {
		return null;
	}
	return this.req.rawBody
};


/**
 * Return all headers
 *
 * @returns {headers|*|headers|headers|headers|headers}
 */
CorsaRequest.prototype.getHeaders = function ()
{
	return this.req.headers;
};

/**
 * Returns single Query param
 *
 * @param param
 * @returns {*}
 */
CorsaRequest.prototype.getQueryParam = function (param)
{
	if (param == undefined || this.req.query == undefined || this.req.query.param == undefined) {
		return null;
	}

	return this.req.query.param;
};


/**
 * Returns all Query Params
 *
 * @returns {*}
 */
CorsaRequest.prototype.getQueryParams = function ()
{
	if (this.req.query == undefined || Object.keys(this.req.query).length < 1) {
		return null
	}
	return this.req.query;
};

/**
 * Returns all Post Params
 *
 * @returns {*}
 */
CorsaRequest.prototype.getPostParams = function ()
{
	if (this.req.postData == undefined) {
		return null
	}
	return this.req.postData;
};

/**
 * Returns requested postParam
 *
 * @param param
 * @returns {*}
 */
CorsaRequest.prototype.getPostParam = function (param)
{
{'fraction_non_alphanumeric': 0.16051873198847263, 'fraction_numerical': 0.001729106628242075, 'mean_word_length': 3.6528150134048256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4360901', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1177, 'n_words': 259}