<commit_before>require 'action_dispatch'

module Acfs
  class Response

    # Quick accessors for format handling.
    module Formats

      def mime_type
        @mime_type ||= Mime::Type.parse(headers['Content-Type']).first
      end

      def json?
        mime_type == Mime::JSON
      end
    end
  end
end<commit_msg>Manual strip mime type parameters for action_dispatch < 4.0.<commit_after>require 'action_dispatch'

module Acfs
  class Response

    # Quick accessors for format handling.
    module Formats

      def mime_type
        @mime_type ||= begin
          content_type = headers['Content-Type'].split(/;\s*\w+="?\w+"?/).first
          Mime::Type.parse(content_type).first
        end
      end

      def json?
        mime_type == Mime::JSON
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09595959595959595, 'fraction_numerical': 0.0025252525252525255, 'mean_word_length': 2.374468085106383, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6316862', 'n_tokens_mistral': 251, 'n_tokens_neox': 239, 'n_words': 62}