<commit_before>module ActionKit
  module Helper
    extend self

    def check_petition_name_is_available(name)
      resp = ActionKit::Client.get('petitionpage', params: {_limit: 1, name: name})

      if resp.response_code == 200
        { valid: JSON.parse(resp.response_body)['meta']['total_count'] == 0, response: JSON.parse(resp.response_body)}
      else
        false
      end
    end
  end
end
<commit_msg>Also sending back responses for helper when code is not 200<commit_after>module ActionKit
  module Helper
    extend self

    def check_petition_name_is_available(name)
      resp = ActionKit::Client.get('petitionpage', params: {_limit: 1, name: name})

      if resp.response_code == 200
        { valid: JSON.parse(resp.response_body)['meta']['total_count'] == 0, response: JSON.parse(resp.response_body)}
      else
        { valid: false, response: JSON.parse(resp.response_body) }
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.10848549946294307, 'fraction_numerical': 0.013963480128893663, 'mean_word_length': 3.3962264150943398, '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': '5252488', 'n_tokens_mistral': 302, 'n_tokens_neox': 279, 'n_words': 71}