<commit_before>var request = require("request");
var cfg = require("../plugin").cfg;
var saveData = require("../plugin").saveData;

/**
 * http plugin for Dromedary framework
 * @param req the HTTP request
 * @param res the HTTP response
 * @param cb the callback function
 */
function plugin(req, res, cb) {
    console.log("->http plugin");
    var _ = cfg(req);
    var id = _.id;
    var url = _.url;
    var method = _.method;

    request({
        uri: _.uri || _.url,
        method: _.method.toUpperCase(),
        timeout: _.timeout,
        followRedirect: false,
        maxRedirects: 0
    }, function(error, response, body) {
        if(error) {
            cb(error);
        } else {
            saveData(req, response, _.data);
            cb();
        }
    });
}
<commit_msg>Update http.js<commit_after>var request = require("request");
var cfg = require("../lib/plugin").cfg;
var saveData = require("../lib/plugin").saveData;

/**
 * http plugin for Dromedary framework
 * @param req the HTTP request
 * @param res the HTTP response
 * @param cb the callback function
 */
function plugin(req, res, cb) {
    console.log("->http plugin");
    var _ = cfg(req);
    request({
        uri: _.uri || _.url,
        method: _.method.toUpperCase(),
        timeout: _.timeout,
        followRedirect: false,
        maxRedirects: 0
    }, function(error, response, body) {
        if(error) {
            cb(error);
        } else {
            saveData(req, response, _.data);
            cb();
        }
    });
}

{'fraction_non_alphanumeric': 0.14761593729588504, 'fraction_numerical': 0.0013063357282821686, 'mean_word_length': 2.185031185031185, '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': '3898008', 'n_tokens_mistral': 453, 'n_tokens_neox': 449, 'n_words': 128}