<commit_before>/**
 * Unified response helper
 * @property {Function}
 */

class Response {
  constructor(content = null, status = 200, mimetype = 'text/plain', headers = {}) {
    this._content = content
    this._status = status
    this._mimetype = mimetype
    this._headers = headers

    if (content) {
      this._make()
    }
  }

  _make() {
    const isLocal = !global.setResponse || !global.HttpResponse
    const args = [this._content, this._status, this._mimetype, this._headers]

    if (isLocal) {
      console.log(args)
      return args
    }

    global.setResponse(new global.HttpResponse(...args))
  }

  header(key, value) {
    this._headers = {
      ...this._headers,
      [key]: value
    }

    return this
  }

  json(content) {
    this._mimetype = 'application/json'
    this._content = JSON.stringify(content)

    this._make()
<commit_msg>fix(response): invalid parameters order<commit_after>/**
 * Unified response helper
 * @property {Function}
 */

class Response {
  constructor(content = null, status = 200, mimetype = 'text/plain', headers = {}) {
    this._content = content
    this._status = status
    this._mimetype = mimetype
    this._headers = headers

    if (content) {
      this._make()
    }
  }

  _make() {
    const isLocal = !global.setResponse || !global.HttpResponse
    const args = [this._status, this._content, this._mimetype, this._headers]

    if (isLocal) {
      console.log(args)
      return args
    }

    global.setResponse(new global.HttpResponse(...args))
  }

  header(key, value) {
    this._headers = {
      ...this._headers,
      [key]: value
    }

    return this
  }

  json(content) {
    this._mimetype = 'application/json'
    this._content = JSON.stringify(content)

    this._make()

{'fraction_non_alphanumeric': 0.13163841807909604, 'fraction_numerical': 0.003389830508474576, 'mean_word_length': 2.5995934959349594, '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': '3255457', 'n_tokens_mistral': 573, 'n_tokens_neox': 548, 'n_words': 119}