<commit_before>'use strict';

// intercepter for res.end
function end() {
    // this function is always called in scope of response object
    /* jshint validthis:true */
    this._closed = true;
    this._intercepted_end.apply(this, arguments);
}

function Accept(accept) {
    var pos = accept.indexOf(';');
    if (pos !== -1) {
        this.params = accept.substring(pos+1);
        accept = accept.substring(0, pos);
    }

    pos = accept.indexOf('/');
    if (pos === -1) {
        this.type = accept;
    } else {
        this.type = accept.substring(0, pos);
        this.subtype = accept.substring(pos+1);
    }

    this.mimeType = (this.subtype ? this.type + '/' + this.subtype : this.type).toLowerCase();
}

Accept.prototype.getType = function() {
    return this.type;
};

Accept.prototype.getSubtype = function() {
    return this.subtype;
};

Accept.prototype.getMimeType = function() {
    return this.mimeType;
};

function REST(handler, domain) {
    this.handler = handler;
}

REST.prototype = {

    handle: function() {

        var self = this;

        // inherit the before functions from the RESTHandler
        var before = this.handler.getBefore(),
            res = this.res;

        if (res) {
            res._intercepted_end = res.end;<commit_msg>Setting this.upgrade to false in the constructor, so that isClosed does not always return false.<commit_after>'use strict';

// intercepter for res.end
function end() {
    // this function is always called in scope of response object
    /* jshint validthis:true */
    this._closed = true;
    this._intercepted_end.apply(this, arguments);
}

function Accept(accept) {
    var pos = accept.indexOf(';');
    if (pos !== -1) {
        this.params = accept.substring(pos+1);
        accept = accept.substring(0, pos);
    }

    pos = accept.indexOf('/');
    if (pos === -1) {
        this.type = accept;
    } else {
        this.type = accept.substring(0, pos);
        this.subtype = accept.substring(pos+1);
    }

    this.mimeType = (this.subtype ? this.type + '/' + this.subtype : this.type).toLowerCase();
}

Accept.prototype.getType = function() {
    return this.type;
};

Accept.prototype.getSubtype = function() {
    return this.subtype;
};

Accept.prototype.getMimeType = function() {
    return this.mimeType;
};

function REST(handler, domain) {
    this.handler = handler;
    this.upgrade = false;
}

REST.prototype = {

    handle: function() {

        var self = this;

        // inherit the before functions from the RESTHandler
        var before = this.handler.getBefore(),
            res = this.res;

        if (res) {
            res._intercepted_end = res.end;
{'fraction_non_alphanumeric': 0.13767302656191546, 'fraction_numerical': 0.004489337822671156, 'mean_word_length': 2.513797634691196, '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': '5252554', 'n_tokens_mistral': 834, 'n_tokens_neox': 815, 'n_words': 201}