<commit_before>var rawBody = require("raw-body");
var serialization = require('../common/serialization');

module.exports = function(req, res, next) {
    rawBody(req, {
        length : req.headers["content-length"],
        limit : "1mb",
        encoding : "utf8"
    }, function(err, string) {
        if (err) {
            return next(err);
        }
        req.body = serialization.parse(string);
        next();
    })
};<commit_msg>Fixing issue in body parser.<commit_after>var rawBody = require("raw-body");
var serialization = require('../common/serialization');

module.exports = function (req, res, next) {
    rawBody(req, {
        length : req.headers["content-length"],
        limit : "1mb",
        encoding : "utf8"
    }, function (err, string) {
        if (err) {
            return next(err);
        }
        try {
            req.body = serialization.parse(string);
            next();
        } catch (err) {
            next(err);
        }
    })
};
{'fraction_non_alphanumeric': 0.15510204081632653, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 2.046583850931677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7187558', 'n_tokens_mistral': 289, 'n_tokens_neox': 288, 'n_words': 62}