<commit_before>/**
 * Creates and executes ajax request (a POST request with json return data type by default).
 * @param {string} url
 * @param {object} params Request parameters.
 * @param {object=} options Standart jQuery.ajax settings object.
 * @returns {Vow.Promise}
 */
ns.http = function(url, params, options) {
    options = no.extend({ type: 'POST', dataType: 'json' }, options || {});
    options.url = url;
    options.data = params;

    var promise = new Vow.Promise();
    $.ajax(options)
        .done(function(data) {
            promise.fulfill(data);
        })
        .fail(function(jqXHR, textStatus, errorThrown) {
            var error = errorThrown || textStatus || 'unknown error';
            // TODO: почему не reject?
            promise.fulfill({
                error: error,
                xhr: jqXHR
            });
        });

    return promise;
};
<commit_msg> [ns.http] Вынести дефолтные параметры в переменную. Fix #282<commit_after>/**
 * Creates and executes ajax request (a POST request with json return data type by default).
 * @param {string} url
 * @param {object} params Request parameters.
 * @param {object=} options Standart jQuery.ajax settings object.
 * @returns {Vow.Promise}
 */
ns.http = function(url, params, options) {
    options = no.extend(ns.http.DEFAULTS, options || {});
    options.url = url;
    options.data = params;

    var promise = new Vow.Promise();
    $.ajax(options)
        .done(function(data) {
            promise.fulfill(data);
        })
        .fail(function(jqXHR, textStatus, errorThrown) {
            var error = errorThrown || textStatus || 'unknown error';
            // TODO: почему не reject?
            promise.fulfill({
                error: error,
                xhr: jqXHR
            });
        });

    return promise;
};

/**
 * Параметры по умолчанию для http-запросов.
 * @type {object}
 */
ns.http.DEFAULTS = {
    dataType: 'json',
    type: 'POST'
};

{'fraction_non_alphanumeric': 0.13309535951045384, 'fraction_numerical': 0.0015298317185109638, 'mean_word_length': 2.2974789915966385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7507377', 'n_tokens_mistral': 598, 'n_tokens_neox': 597, 'n_words': 166}