<commit_before>'use strict';

const defaults = require('lodash.defaults');
const got = require('got');
const path = require('path');

var packageJSON = findOwnPackageJOSN();

function findOwnPackageJOSN() {
    var foundPackageJSON = {};
    var testLoc = __dirname; // current directory to test for a package.json
    for (var level = 0; level < 5; level++) {
        try {
            foundPackageJSON = require(testLoc + '/package.json');
            return foundPackageJSON;
        } catch (err) {
            /* do nothing */
        }
        testLoc = path.join(testLoc, '..');
    }
}

// client library defaults
var requestDefaults = {
    json: true,
    timeout: 5000,
    baseUrl: 'https://api.badgeup.io',
    headers: {
        'User-Agent': packageJSON.name + ' ' + packageJSON.version,
        'Accept': 'application/json'
    }
};

class BadgeUpHttp {
    // Constructor for the HTTP stack for BadgeUp
    //@param globalOpts: Options from the user for BadgeUp as a whole.
    constructor(globalReqOpts) {
        this.globalReqOpts = globalReqOpts || {};
    }

    //@param reqOpts: Request options from this library's functions.
    //@param userOpts: Option overrides from the user. Highest priority.
    //@return: Returns a Promise that resolves with the request data
    makeRequest(reqOpts, userOpts) {
        return got(defaults({}, userOpts, reqOpts, this.globalReqOpts, requestDefaults));
    }

}

module.exports = BadgeUpHttp;
<commit_msg>Updating default API endpoint, request headers<commit_after>'use strict';

const defaults = require('lodash.defaults');
const got = require('got');
const path = require('path');

var packageJSON = findOwnPackageJOSN();

function findOwnPackageJOSN() {
    var foundPackageJSON = {};
    var testLoc = __dirname; // current directory to test for a package.json
    for (var level = 0; level < 5; level++) {
        try {
            foundPackageJSON = require(testLoc + '/package.json');
            return foundPackageJSON;
        } catch (err) {
            /* do nothing */
        }
        testLoc = path.join(testLoc, '..');
    }
}

// client library defaults
var requestDefaults = {
    json: true,
    timeout: 5000,
    baseUrl: 'https://api.useast1.badgeup.io',
    headers: {
        'user-agent': packageJSON.name + '/' + packageJSON.version + ' (https://www.badgeup.io/)',
        'accept': 'application/json'
    }
};

class BadgeUpHttp {
    // Constructor for the HTTP stack for BadgeUp
    //@param globalOpts: Options from the user for BadgeUp as a whole.
    constructor(globalReqOpts) {
        this.globalReqOpts = globalReqOpts || {};
    }

    //@param reqOpts: Request options from this library's functions.
    //@param userOpts: Option overrides from the user. Highest priority.
    //@return: Returns a Promise that resolves with the request data
    makeRequest(reqOpts, userOpts) {
        return got(defaults({}, userOpts, reqOpts, this.globalReqOpts, requestDefaults));
    }

}

module.exports = BadgeUpHttp;

{'fraction_non_alphanumeric': 0.12209688122096882, 'fraction_numerical': 0.0043132050431320505, 'mean_word_length': 2.821292775665399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, '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': '7336613', 'n_tokens_mistral': 887, 'n_tokens_neox': 886, 'n_words': 254}