<commit_before>// From https://gist.github.com/epeli/11209665

var Promise = require("bluebird");

var Request = require("superagent").Request;

/**
 * @namespace utils
 * @class Superagent
 */

/**
 *
 * Add promise support for superagent/supertest
 *
 * Call .promise() to return promise for the request
 *
 * @method promise
 * @return {Bluebird.Promise}
 */
Request.prototype.promise = function() {
    var self = this;
    return new Promise(function(resolve, reject){
        Request.prototype.end.call(self, function(err, res) {
            if (err) reject(err);
            else resolve(res.body);
        });
    });
};<commit_msg>Occassionally consumers will want more than just response body<commit_after>// From https://gist.github.com/epeli/11209665

var Promise = require("bluebird");

var Request = require("superagent").Request;

/**
 * @namespace utils
 * @class Superagent
 */

/**
 *
 * Add promise support for superagent/supertest
 *
 * Call .promise() to return promise for the request
 *
 * @method promise
 * @return {Bluebird.Promise}
 */
Request.prototype.promise = function() {
    var self = this;
    return new Promise(function(resolve, reject){
        Request.prototype.end.call(self, function(err, res) {
            if (err) reject(err);
            else resolve(res);
        });
    });
};
{'fraction_non_alphanumeric': 0.14123867069486404, 'fraction_numerical': 0.012084592145015106, 'mean_word_length': 3.1149068322981366, 'pattern_counts': {'":': 0, '<': 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': '6084589', 'n_tokens_mistral': 398, 'n_tokens_neox': 389, 'n_words': 102}