<commit_before>'use strict';

var format = require('./format');
var settings = require('./settings');
var _ = require('underscore');

module.exports = {
  make: function(req, suite, suiteName, requestAgent, callback){
    requestAgent.make(req, function(err, response){

      var res = !!response ? {
        header: response.header,
        statusCode: response.statusCode,
        body: response.text,
        type: response.type
      } : false;

      if(err){
        var code = err.code || 'Unknown';

        return callback({
          code: code,
          message: err.message || code
        }, res);
      }
      else if(!!suite.endpoint.expectedStatusCode && suite.endpoint.expectedStatusCode !== response.status) {
        return callback({
          code: settings.errorCodes.HTTP_STATUS_CODE_NOT_MATCHING,
          message: format(settings.errorMessages.HTTP_STATUS_CODE_NOT_MATCHING, suite.endpoint.expectedStatusCode, response.status, suiteName)
        }, res);
			}
      else {
				callback(null, res);
			}
    });
  },
  setup: function(suiteName, suiteHref, suite, requestAgent){
    var self = this,<commit_msg>superagent now throws an error when status is not 2xx<commit_after>'use strict';

var format = require('./format');
var settings = require('./settings');
var _ = require('underscore');

module.exports = {
  make: function(req, suite, suiteName, requestAgent, callback){
    requestAgent.make(req, function(err, response){

      var res = !!response ? {
        header: response.header,
        statusCode: response.statusCode,
        body: response.text,
        type: response.type
      } : false;

      if(err && !res){
        var code = err.code || 'Unknown';

        return callback({
          code: code,
          message: err.message || code
        }, res);
      }
      else if(!!suite.endpoint.expectedStatusCode && suite.endpoint.expectedStatusCode !== response.status) {
        return callback({
          code: settings.errorCodes.HTTP_STATUS_CODE_NOT_MATCHING,
          message: format(settings.errorMessages.HTTP_STATUS_CODE_NOT_MATCHING, suite.endpoint.expectedStatusCode, response.status, suiteName)
        }, res);
			}
      else {
				callback(null, res);
			}
    });
  },
  setup: function(suiteName, suiteHref, suite, requestAgent){
    var self = this,
{'fraction_non_alphanumeric': 0.12596732588134135, 'fraction_numerical': 0.0004299226139294927, 'mean_word_length': 2.802287581699346, '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': '3477281', 'n_tokens_mistral': 664, 'n_tokens_neox': 644, 'n_words': 149}