<commit_before>var assert = require('assert');
var proxy = require('../../lib');
var util = require('../util.test');
var request = require('request');
var r = request.defaults({ 'proxy': 'http://127.0.0.1:' + proxy.getPortSync() });

// describe('request', function() {
  it('#default', function(done) {
    r({ url: 'http://127.0.0.1:' + util.httpServerPort + '/test' },
    function(err, res, body) {
      assert(body === 'HTTP');
      done();
    });
  });
  it('#server', function(done) {
    r({ url: 'http://127.0.0.1:7001/test' },
    function(err, res, body) {
      assert(body === 'Hello world!');
      done();
    });
  });
  it('#host', function(done) {
    var headers = {};
    proxy.setHost(headers, '127.0.0.1:' + util.httpsServerPort);
    proxy.setHttpsRequest(headers);
    r({
      url: 'http://www.qq.com/abc',
      headers: headers,
    }, function(err, res, body) {
      assert(body === 'HTTPS');
      done();
    });
  });
  it('#proxy', function(done) {
    var headers = {};
    proxy.setProxy(headers, '127.0.0.1:' + util.proxyServerPort);
    r({
      url: 'http://www.qq.com/abc',
      headers: headers,
    }, function(err, res, body) {
      assert(body === 'HTTP');
      done();
    });
  });
//   it('#socks', function(done) {

//   });
//   it('#https', function(done) {

//   });
//   it('#mock', function(done) {

//   });
// });<commit_msg>test: request<commit_after>var assert = require('assert');
var proxy = require('../../lib');
var util = require('../util.test');
var request = require('request');
var r = request.defaults({ 'proxy': 'http://127.0.0.1:' + proxy.getPortSync() });

// describe('request', function() {
  it('#default', function(done) {
    r({ url: 'http://127.0.0.1:' + util.httpServerPort + '/test' },
    function(err, res, body) {
      assert(body === 'HTTP');
      done();
    });
  });
  it('#server', function(done) {
    r({ url: 'http://127.0.0.1:7001/test' },
    function(err, res, body) {
      assert(body === 'Hello world!');
      done();
    });
  });
  it('#host', function(done) {
    var headers = {};
    proxy.setHost(headers, '127.0.0.1:' + util.httpsServerPort);
    proxy.setHttpsRequest(headers);
    r({
      url: 'http://www.qq.com/abc',
      headers: headers,
    }, function(err, res, body) {
      assert(body === 'HTTPS');
      done();
    });
  });
  it('#proxy', function(done) {
    var headers = {};
    proxy.setProxy(headers, '127.0.0.1:' + util.proxyServerPort);
    r({
      url: 'http://www.qq.com/abc',
      headers: headers,
    }, function(err, res, body) {
      assert(body === 'HTTP');
      done();
    });
  });
//   it('#socks', function(done) {

//   });
  it('#https', function(done) {
    var headers = {};
    proxy.setHttpsRequest(headers);
    proxy.setHost(headers, '127.0.0.1');
    r({
      url: 'http://www.qq.com:' + util.httpsServerPort + '/abc',
      headers: headers,
    }, function(err, res, body) {
      assert(body === 'HTTPS');
      done();
    });
  });
//   it('#mock', function(done) {

//   });
// });
{'fraction_non_alphanumeric': 0.2445099967223861, 'fraction_numerical': 0.024254342838413635, 'mean_word_length': 2.624703087885986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 11, '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': '7527723', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1061, 'n_words': 195}