<commit_before>assert = chai.assert
request = httprequest

testServerUrl = 'http://localhost:4001'

describe 'httprequest', ->
  it 'performs a get request', (done) ->
    request.get "#{ testServerUrl }/getjson", (err, res) ->
      assert.equal res.text, JSON.stringify(hello: 'world')
      done()

  it 'sends headers', (done) ->
    req =
      url: "#{ testServerUrl }/headers"
      headers:
        hello: 'world'
    request.get req, (err, res) ->
      json = JSON.parse res.text
      assert.equal json.hello, 'world'
      done()

  describe 'use', ->
    it 'adds a plugin', ->
      assert.equal request.use({}).plugins.length, 1

    it "doesn't mutate the request function", ->
      request.use {}
      assert.equal request.plugins.length, 0<commit_msg>Don't assume we have no plugins by default<commit_after>assert = chai.assert
request = httprequest

testServerUrl = 'http://localhost:4001'

describe 'httprequest', ->
  it 'performs a get request', (done) ->
    request.get "#{ testServerUrl }/getjson", (err, res) ->
      assert.equal res.text, JSON.stringify(hello: 'world')
      done()

  it 'sends headers', (done) ->
    req =
      url: "#{ testServerUrl }/headers"
      headers:
        hello: 'world'
    request.get req, (err, res) ->
      json = JSON.parse res.text
      assert.equal json.hello, 'world'
      done()

  describe 'use', ->
    it 'adds a plugin', ->
      startCount = request.plugins.length
      assert.equal request.use({}).plugins.length, startCount + 1

    it "doesn't mutate the request function", ->
      startCount = request.plugins.length
      request.use {}
      assert.equal request.plugins.length, startCount
{'fraction_non_alphanumeric': 0.14430530709600478, 'fraction_numerical': 0.00655933214072749, 'mean_word_length': 2.7288888888888887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '5350396', 'n_tokens_mistral': 535, 'n_tokens_neox': 512, 'n_words': 141}