<commit_before>var http = require('http');
var _    = require('underscore');

function request(rest, method, data, done)
{
  done = done || data;

  var ctype = 'text/plain';
  if (typeof data === 'object') {
    data = JSON.stringify(data);
    ctype = 'application/json';
  }

  var options = {
    'hostname' : 'localhost',
    'port'     : 5000, /* Default port of canumb */
    'path'     : '/' + rest.join('/'),
    'method'   : method.toUpperCase(),
    'headers'  : {
      'Connection'     : 'close',
      'Content-Type'   : ctype,
    }
  };

  var hasEntityBody = data && _.contains(['POST', 'PUT'], method.toUpperCase());<commit_msg>Tests: Call correct port when API testing<commit_after>var http = require('http');
var _    = require('underscore');

function request(rest, method, data, done)
{
  done = done || data;

  var ctype = 'text/plain';
  if (typeof data === 'object') {
    data = JSON.stringify(data);
    ctype = 'application/json';
  }

  var options = {
    'hostname' : 'localhost',
    'port'     : process.env.PORT,
    'path'     : '/' + rest.join('/'),
    'method'   : method.toUpperCase(),
    'headers'  : {
      'Connection'     : 'close',
      'Content-Type'   : ctype,
    }
  };

  var hasEntityBody = data && _.contains(['POST', 'PUT'], method.toUpperCase());
{'fraction_non_alphanumeric': 0.18649270913277052, 'fraction_numerical': 0.0030698388334612432, 'mean_word_length': 2.7797101449275363, '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': '4852770', 'n_tokens_mistral': 439, 'n_tokens_neox': 426, 'n_words': 99}