<commit_before>var request = require('request'),
    ntlm = require('httpntlm');

module.exports = {
  makeRequest: function (opts, callback) {
    if (opts.authentication && opts.authentication.trim() === 'ntlm') {
      ntlm.get({
        url: opts.url,
        username: opts.username,
        password: <PASSWORD>,
        headers: opts.headers || {}
      }, function (error, response) {
        callback(error, JSON.parse(response.body));
      });
    } else {
      request({
          url: opts.url,
          rejectUnauthorized: false,
          headers: opts.headers || {},
          json: true
        },
        function (error, response, body) {
          callback(error, body);
        });
    }
  }
};<commit_msg>Give the user a little more feedback if the web request fails. eg. 401 Unauthorised because our PAT has expired!<commit_after>var request = require('request'),
    ntlm = require('httpntlm');
    http = require('http');

module.exports = {
  makeRequest: function (opts, callback) {
    if (opts.authentication && opts.authentication.trim() === 'ntlm') {
      ntlm.get({
        url: opts.url,
        username: opts.username,
        password: <PASSWORD>,
        headers: opts.headers || {}
      }, function (error, response) {
        callback(error, JSON.parse(response.body));
      });
    } else {
      request({
          url: opts.url,
          rejectUnauthorized: false,    // Don't validate SSL certs
          headers: opts.headers || {},
          json: true
        },
        function (error, response, body) {
          if (response.statusCode === 200) {
            callback(error, body);
          } else {
            callback('HTTP Reponse: '+response.statusCode+' '+http.STATUS_CODES[response.statusCode]);
          }
        });
    }
  }
};
{'fraction_non_alphanumeric': 0.1424596549805231, 'fraction_numerical': 0.00333889816360601, 'mean_word_length': 2.132404181184669, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3254340', 'n_tokens_mistral': 517, 'n_tokens_neox': 501, 'n_words': 121}