<commit_before>"use strict";
var request = require('request')
  , fs = require('fs')
  , logger = require('./logger').get('appium');

exports.registerNode = function (configFile) {
  fs.readFile(configFile, 'utf-8', function (err, data, cb) {
    if (err) {
    logger.error("Unable to load node configuration file to register with grid");
    cb("Unable to load node configuration file to register with grid");
    code = code || 1;
    }
    // Check presence of data before posting  it to the selenium grid
    if (data) {
      postRequest(data);
    } else {
      logger.error("No data found in the node configuration  file to send to the grid");
      cb("No data found in the node configuration  file to send to the grid");
      code = code || 1;
    }
  });
};

function postRequest(data) {
  //parse json to get hub host and port
  var jsonObject = JSON.parse(data);
  // prepare the header
  var post_headers = {
    'Content-Type'  : 'application/json'
    , 'Content-Length': data.length
  };
  // the post options
  var options_post = {
    url       : 'https://'+jsonObject.configuration.hubHost+':'+jsonObject.configuration.hubPort+'/grid/register'
    , method  : 'POST'
    , body    : data
    , headers : post_headers
  };
  // make the http POST to the grid for registration
  var reqPost = request(options_post, function (error, response, body) {
    if (error !== null || response.statusCode !== 200) {
      logger.error("Request to register with grid was Unsuccessful...");
    } else {
      var logMessage = "Appium successfully registered with the grid on " + jsonObject.configuration.hubHost + ":" + jsonObject.configuration.hubPort;
      logger.info(logMessage.cyan);
    }
  });
}

<commit_msg>Removed 'code' Updated 'https' to 'http'<commit_after>"use strict";
var request = require('request')
  , fs = require('fs')
  , logger = require('./logger').get('appium');

exports.registerNode = function (configFile) {
  fs.readFile(configFile, 'utf-8', function (err, data, cb) {
    if (err) {
    logger.error("Unable to load node configuration file to register with grid");
    cb("Unable to load node configuration file to register with grid");
    }
    // Check presence of data before posting  it to the selenium grid
    if (data) {
      postRequest(data);
    } else {
      logger.error("No data found in the node configuration  file to send to the grid");
      cb("No data found in the node configuration  file to send to the grid");
    }
  });
};

function postRequest(data) {
  //parse json to get hub host and port
  var jsonObject = JSON.parse(data);
  // prepare the header
  var post_headers = {
    'Content-Type'  : 'application/json'
    , 'Content-Length': data.length
  };
  // the post options
  var options_post = {
    url       : 'http://'+jsonObject.configuration.hubHost+':'+jsonObject.configuration.hubPort+'/grid/register'
    , method  : 'POST'
    , body    : data
    , headers : post_headers
  };
  // make the http POST to the grid for registration
  var reqPost = request(options_post, function (error, response, body) {
    if (error !== null || response.statusCode !== 200) {
      logger.error("Request to register with grid was Unsuccessful...");
    } else {
      var logMessage = "Appium successfully registered with the grid on " + jsonObject.configuration.hubHost + ":" + jsonObject.configuration.hubPort;
      logger.info(logMessage.cyan);
    }
  });
}


{'fraction_non_alphanumeric': 0.1269656377402446, 'fraction_numerical': 0.0029120559114735, 'mean_word_length': 3.118705035971223, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '5127131', 'n_tokens_mistral': 999, 'n_tokens_neox': 985, 'n_words': 325}