<commit_before>module JSONApiRender
  extend ActiveSupport::Concern

  included do
    ActionController.add_renderer :json_api do |obj, options|
      response_body = JSONApiResponse.format_response_body(obj)
      if options[:generate_response_obj_etag]
        self.headers["ETag"] = JSONApiResponse.response_etag_header(response_body)
      end

      if options[:add_http_cache] == "true"
        http_cacheable = HttpCacheable.new(controlled_resources)
        if http_cacheable.public_resources?
          self.headers["Cache-Control"] = http_cacheable.resource_cache_directive
        end
      end

      self.content_type ||= Mime::Type.lookup("application/vnd.api+json; version=1")
      self.response_body = response_body
    end
  end<commit_msg>disable http caching in production (#2282)<commit_after>module JSONApiRender
  extend ActiveSupport::Concern

  included do
    ActionController.add_renderer :json_api do |obj, options|
      response_body = JSONApiResponse.format_response_body(obj)
      if options[:generate_response_obj_etag]
        self.headers["ETag"] = JSONApiResponse.response_etag_header(response_body)
      end

      if !Rails.env.production? && options[:add_http_cache] == "true"
        http_cacheable = HttpCacheable.new(controlled_resources)
        if http_cacheable.public_resources?
          self.headers["Cache-Control"] = http_cacheable.resource_cache_directive
        end
      end

      self.content_type ||= Mime::Type.lookup("application/vnd.api+json; version=1")
      self.response_body = response_body
    end
  end
{'fraction_non_alphanumeric': 0.08847867600254615, 'fraction_numerical': 0.0038192234245703373, 'mean_word_length': 3.8518518518518516, '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': '5552768', 'n_tokens_mistral': 472, 'n_tokens_neox': 456, 'n_words': 77}