<commit_before>import http from 'http';

const API_DOMAIN = process.env.NODE_ENV === 'production' ? 'https://intense-reef-19040.herokuapp.com' : 'http://localhost:8080';

export default (method, uri) => {
  const request = http[method.toLowerCase()];

  const promise = new Promise((resolve, reject) => {
    request({ path: `${API_DOMAIN}${uri}` }, (response) => {

      const data = [];
      response.on('data', (chunk) => data.push(chunk));
      response.on('end', () => resolve(JSON.parse(data.join(''))));
      response.on('error', (error) => reject(error));
    })
  });

  return promise
    .then(response => ({ response }))<commit_msg>change production API domain<commit_after>import http from 'http';

const API_DOMAIN = process.env.NODE_ENV === 'production' ? 'https://genau-service.herokuapp.com' : 'http://localhost:8080';

export default (method, uri) => {
  const request = http[method.toLowerCase()];

  const promise = new Promise((resolve, reject) => {
    request({ path: `${API_DOMAIN}${uri}` }, (response) => {

      const data = [];
      response.on('data', (chunk) => data.push(chunk));
      response.on('end', () => resolve(JSON.parse(data.join(''))));
      response.on('error', (error) => reject(error));
    })
  });

  return promise
    .then(response => ({ response }))
{'fraction_non_alphanumeric': 0.20903522205206737, 'fraction_numerical': 0.009954058192955589, 'mean_word_length': 3.96958174904943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '3786863', 'n_tokens_mistral': 417, 'n_tokens_neox': 409, 'n_words': 83}