<commit_before>const fs = require('fs');
const http = require('http');
const	https = require('https');

const loadHTTP = (uri, options, callback) => {
	const adapter = uri.startsWith('https:') ? https : http;

	const options_ = {
		timeout: options ? options.timeout : 5000
	};

	if (process.env.NODE_ENV && process.env.NODE_ENV === 'test' && uri.startsWith('https:')) {
		// In a test environment, don't reject unauthorized SSL connections
		options_.agent = new https.Agent({
			rejectUnauthorized: false
		});
	}

	adapter.get(uri, options_, (response) => {
		const { statusCode } = response;
		let err;

		if (statusCode !== 200) {
			err = new Error('Request Failed.\n' +
				`Status Code: ${statusCode}`);
		}

		if (err) {
			// Consume response data to free up memory
			response.resume();
			return callback(err);
		}

		response.setEncoding('utf8');
		let rawData = '';
		let value;
		response.on('data', (chunk) => {
			rawData += chunk;
		});
		response.on('end', () => {
			try {
				value = JSON.parse(rawData);
				callback(null, value);
			} catch (error) {<commit_msg>Slight refactor - one fewer uri.startsWith check<commit_after>const fs = require('fs');
const http = require('http');
const	https = require('https');

const loadHTTP = (uri, options, callback) => {
	const options_ = {
		timeout: options ? options.timeout : 5000
	};

	let adapter = http;

	if (uri.startsWith('https:')) {
		adapter = https;

		if (process.env.NODE_ENV && process.env.NODE_ENV === 'test') {
			// In a test environment, don't reject unauthorized SSL connections
			options_.agent = new https.Agent({
				rejectUnauthorized: false
			});
		}
	}

	adapter.get(uri, options_, (response) => {
		const { statusCode } = response;
		let err;

		if (statusCode !== 200) {
			err = new Error('Request Failed.\n' +
				`Status Code: ${statusCode}`);
		}

		if (err) {
			// Consume response data to free up memory
			response.resume();
			return callback(err);
		}

		response.setEncoding('utf8');
		let rawData = '';
		let value;
		response.on('data', (chunk) => {
			rawData += chunk;
		});
		response.on('end', () => {
			try {
				value = JSON.parse(rawData);
				callback(null, value);
			} catch (error) {
{'fraction_non_alphanumeric': 0.16530426884650318, 'fraction_numerical': 0.007266121707538601, 'mean_word_length': 3.406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '173978', 'n_tokens_mistral': 826, 'n_tokens_neox': 711, 'n_words': 188}