<commit_before>const http           = require('http')
    , EE             = require('events').EventEmitter
    , xtend          = require('xtend')
    , bl             = require('bl')
    , jsonist        = require('jsonist')
    , _jsonistget    = jsonist.get
    , _jsonistpost   = jsonist.post


function makeServer (data) {
  var ee     = new EE()
    , i      = 0
    , server = http.createServer(function (req, res) {
        ee.emit('request', req)

        var _data = Array.isArray(data) ? data[i++] : data
        res.end(JSON.stringify(_data))

        if (!Array.isArray(data) || i == data.length)
          server.close()
      })
      .listen(0, function (err) {
        if (err)
          return ee.emit('error', err)

        jsonist.get = function (url, opts, callback) {
          ee.emit('get', url, opts)
          return _jsonistget('http://localhost:' + server.address().port, opts, callback)
        }

        ee.emit('ready')
      })
      .on('close', ee.emit.bind(ee, 'close'))<commit_msg>hook jsonist.post as well<commit_after>const http           = require('http')
    , EE             = require('events').EventEmitter
    , xtend          = require('xtend')
    , bl             = require('bl')
    , jsonist        = require('jsonist')
    , _jsonistget    = jsonist.get
    , _jsonistpost   = jsonist.post


function makeServer (data) {
  var ee     = new EE()
    , i      = 0
    , server = http.createServer(function (req, res) {
        ee.emit('request', req)

        var _data = Array.isArray(data) ? data[i++] : data
        res.end(JSON.stringify(_data))

        if (!Array.isArray(data) || i == data.length)
          server.close()
      })
      .listen(0, function (err) {
        if (err)
          return ee.emit('error', err)

        jsonist.get = function (url, opts, callback) {
          ee.emit('get', url, opts)
          return _jsonistget('http://localhost:' + server.address().port, opts, callback)
        }

        jsonist.post = function (url, data,  opts, callback) {
          ee.emit('post', url, data, opts)
          return _jsonistpost('http://localhost:' + server.address().port, data, opts, callback)
        }

        ee.emit('ready')
      })
      .on('close', ee.emit.bind(ee, 'close'))
{'fraction_non_alphanumeric': 0.15371024734982333, 'fraction_numerical': 0.0017667844522968198, 'mean_word_length': 1.9301423027166882, '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': '1899021', 'n_tokens_mistral': 718, 'n_tokens_neox': 699, 'n_words': 150}