<commit_before>import hrp from 'http-request-plus'
import ProxyAgent from 'proxy-agent'

import { firstDefined } from '../utils'

export default class Http {
  constructor(
    _,
    { httpProxy = firstDefined(process.env.http_proxy, process.env.HTTP_PROXY) }
  ) {
    this._proxy = httpProxy && new ProxyAgent(httpProxy)
  }

  httpRequest(...args) {
    return hrp(
      {
        agent: this._proxy,
      },
      ...args
    )
  }
}
<commit_msg>feat(server): new `setHttpProxy` internal method<commit_after>import hrp from 'http-request-plus'
import ProxyAgent from 'proxy-agent'

import { firstDefined } from '../utils'

export default class Http {
  constructor(
    _,
    { httpProxy = firstDefined(process.env.http_proxy, process.env.HTTP_PROXY) }
  ) {
    this.setHttpProxy(httpProxy)
  }

  httpRequest(...args) {
    return hrp(
      {
        agent: this._agent,
      },
      ...args
    )
  }

  setHttpProxy(proxy) {
    this._agent = proxy == null ? undefined : new ProxyAgent(proxy)
  }
}

{'fraction_non_alphanumeric': 0.1282051282051282, 'fraction_numerical': 0.0, 'mean_word_length': 2.717948717948718, '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': '1355275', 'n_tokens_mistral': 340, 'n_tokens_neox': 338, 'n_words': 68}