<commit_before>var Q = require("q");
var _ = require("underscore");
var request = require("request");

var method = function(key, httpMethod, endpoint, options) {
    var d = Q.defer();
    request(_.extend({
        method: httpMethod,
        url: "https://api.heroku.com/"+endpoint,
        json: true,
        headers: {
            "Accept": "application/vnd.heroku+json; version=3",
            "Authorization": new Buffer(":" + key).toString('base64')
        }
    }, options || {}),
    function(error, response, body) {
        if (!error && response.statusCode == 200) {
            d.resolve(body);
        } else {
            d.reject(error || body.message || body);
        }
    });

    return d.promise;
};

module.exports = {
    'method': method
};<commit_msg>Fix heroku api auth<commit_after>var Q = require("q");
var _ = require("underscore");
var request = require("request");

var method = function(key, httpMethod, endpoint, options) {
    var d = Q.defer();
    request(_.extend({
        method: httpMethod,
        url: "https://api.heroku.com/"+endpoint,
        json: true,
        headers: {
            "Accept": "application/vnd.heroku+json; version=3",
            "Authorization": "Basic "+(new Buffer(":" + key).toString('base64'))
        }
    }, options || {}),
    function(error, response, body) {
        if (!error && response.statusCode == 200) {
            d.resolve(body);
        } else {
            d.reject(error || body.message || body);
        }
    });

    return d.promise;
};

module.exports = {
    'method': method
};
{'fraction_non_alphanumeric': 0.17184527584020293, 'fraction_numerical': 0.007609384908053266, 'mean_word_length': 2.3221052631578947, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '897394', 'n_tokens_mistral': 481, 'n_tokens_neox': 468, 'n_words': 104}