<commit_before>/* Library to expose the data that Express already knows about to the client-side via JSON data embedded in the markup. */
module.exports = function(config) {
    "use strict";
    var fluid = require('infusion');
    var data = fluid.registerNamespace("gpii.ctr.lib.data");

    data.exposeRequestData = function (req,options) {
        if (req.path)    { options.path    = req.path;}
        if (req.params)  { options.params  = req.params;}
        if (req.body)    { options.body    = req.body;}
        if (req.query)   { options.query   = req.query;}
        if (req.cookies) {
            var safeCookies = {};
            config.safeCookies.forEach(function(key){
                if (req.cookies[key]) {
                    var value = "";
                    try {
                        value = JSON.parse(req.cookies[key]);
                    } catch(e) {
                        value = req.cookies[key];
                    }
                    safeCookies[key] = value;
                }
            });
            if (Object.keys(safeCookies).length > 0) {
                options.cookies = JSON.stringify(safeCookies);
            }
        }
    };

    return data;
};

<commit_msg>Fixed bug with login form link:  CTR-101<commit_after>/* Library to expose the data that Express already knows about to the client-side via JSON data embedded in the markup. */
module.exports = function(config) {
    "use strict";
    var fluid = require('infusion');
    var data = fluid.registerNamespace("gpii.ctr.lib.data");

    data.exposeRequestData = function (req,options) {
        if (req.originalUrl) { options.path    = req.originalUrl;}
        if (req.params)      { options.params  = req.params;}
        if (req.body)        { options.body    = req.body;}
        if (req.query)       { options.query   = req.query;}
        if (req.cookies)     {
            var safeCookies = {};
            config.safeCookies.forEach(function(key){
                if (req.cookies[key]) {
                    var value = "";
                    try {
                        value = JSON.parse(req.cookies[key]);
                    } catch(e) {
                        value = req.cookies[key];
                    }
                    safeCookies[key] = value;
                }
            });
            if (Object.keys(safeCookies).length > 0) {
                options.cookies = JSON.stringify(safeCookies);
            }
        }
    };

    return data;
};


{'fraction_non_alphanumeric': 0.1187800963081862, 'fraction_numerical': 0.0020064205457463883, 'mean_word_length': 1.4732142857142858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5078728', 'n_tokens_mistral': 712, 'n_tokens_neox': 672, 'n_words': 154}