<commit_before>module RequestsHelper
  # Format a HTTP header output.
  #
  # This method captializes the first letter of each word and after each hyphen.
  #
  # Example:
  #
  #   cache-control    => Cache-Control
  #   x-frame-options  => X-Frame-Options
  #   x-xss-protection => X-Xss-Protection
  #
  # Returns a formatted string.
  def format_http_header(word)
    word.gsub(/\w+|-/, &:capitalize)
  end
end<commit_msg>Create helper for checking JSON responses<commit_after>module RequestsHelper
  # Format a HTTP header output.
  #
  # This method captializes the first letter of each word and after each hyphen.
  #
  # Example:
  #
  #   cache-control    => Cache-Control
  #   x-frame-options  => X-Frame-Options
  #   x-xss-protection => X-Xss-Protection
  #
  # Returns a formatted string.
  def format_http_header(word)
    word.gsub(/\w+|-/, &:capitalize)
  end

  # Determine if the response is JSON.
  #
  # Using the content-type header, check if JSON is defined within it.
  #
  # Returns boolean.
  def is_json_response?
    if @response_data['headers']['content-type'].include? 'json'
      return true
    else
      return false
    end
  end
end
{'fraction_non_alphanumeric': 0.10350727117194183, 'fraction_numerical': 0.0, 'mean_word_length': 2.8613861386138613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1856573', 'n_tokens_mistral': 391, 'n_tokens_neox': 380, 'n_words': 109}