<commit_before>require 'active_support/hash_with_indifferent_access'

module Newark
  class Request < Rack::Request

    def uri
      URI(base_url + fullpath)
    end

    def params
      @params ||= ActiveSupport::HashWithIndifferentAccess.new(super)
    end

    def body
      @body ||= @env['rack.input'].read
    end

    def headers
      @headers ||= original_headers
    end

    protected

    def original_headers
      {}.tap do |headers|
        env.select { |k, v| k.start_with?('HTTP_') }.each_pair do |k, v|<commit_msg>Better URI generation<commit_after>require 'active_support/hash_with_indifferent_access'

module Newark
  class Request < Rack::Request

    def uri
      uri = "#{scheme}://#{host_with_port}#{path_info}"
      uri << "?#{query_string}" unless query_string.empty?
      URI(uri)
    end

    def params
      @params ||= ActiveSupport::HashWithIndifferentAccess.new(super)
    end

    def body
      @body ||= @env['rack.input'].read
    end

    def headers
      @headers ||= original_headers
    end

    protected

    def original_headers
      {}.tap do |headers|
        env.select { |k, v| k.start_with?('HTTP_') }.each_pair do |k, v|
{'fraction_non_alphanumeric': 0.11704834605597965, 'fraction_numerical': 0.0, 'mean_word_length': 2.8562091503267975, 'pattern_counts': {'":': 0, '<': 7, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6398706', 'n_tokens_mistral': 390, 'n_tokens_neox': 372, 'n_words': 88}