<commit_before>'use strict';

/**
 * @license
 * (c) 2014 Cluster Labs, Inc. https://cluster.co/
 * License: MIT
 */


var urls = skit.platform.urls;
var util = skit.platform.util;

var server = __module__.server;
var browser = __module__.browser;
var Response = __module__.Response;

var environment = server || browser;

return {
  send: function(url, opt_options) {
    var options = opt_options || {}; 

    var method = (options.method || 'GET').toUpperCase();
    var body = options.body || '';
    var contentType = '';
    if (options.params) {
      if (method == 'GET') {
        url = urls.appendParams(url, options.params);
      } else if (options.params) {
        body = urls.toFormEncodedString(options.params);
        contentType = 'application/x-www-form-urlencoded';
      }
    }

    var headers = null;
    if (contentType) {
      headers = {'Content-Type': contentType};
    }

    var sender = options.proxy || environment.send;
    sender(method, url, headers, body, function(status, headers, body) {
      var response = new Response(status, headers, body);<commit_msg>Add some request logging.<commit_after>'use strict';

/**
 * @license
 * (c) 2014 Cluster Labs, Inc. https://cluster.co/
 * License: MIT
 */


var urls = skit.platform.urls;
var util = skit.platform.util;

var server = __module__.server;
var browser = __module__.browser;
var Response = __module__.Response;

var environment = server || browser;

return {
  send: function(url, opt_options) {
    var options = opt_options || {}; 

    var startTime = +(new Date());
    var method = (options.method || 'GET').toUpperCase();
    var body = options.body || '';
    var contentType = '';
    if (options.params) {
      if (method == 'GET') {
        url = urls.appendParams(url, options.params);
      } else if (options.params) {
        body = urls.toFormEncodedString(options.params);
        contentType = 'application/x-www-form-urlencoded';
      }
    }

    var headers = null;
    if (contentType) {
      headers = {'Content-Type': contentType};
    }

    var sender = options.proxy || environment.send;
    sender(method, url, headers, body, function(status, headers, body) {
      // Don't log proxied requests because they'll get logged twice.
      util.log('[REQUEST DONE] ' + method + ' ' + url + ' - ' + (+(new Date()) - startTime) + 'ms');

      var response = new Response(status, headers, body);
{'fraction_non_alphanumeric': 0.14670534604227103, 'fraction_numerical': 0.003315375051802735, 'mean_word_length': 2.9834983498349836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1517848', 'n_tokens_mistral': 750, 'n_tokens_neox': 725, 'n_words': 195}