<commit_before>module RestSpy
  class Request
    def initialize(port, method, path, headers, body=nil)
      @port = port
      @method = method.upcase
      @path = path
      @headers = headers
      @body = body
    end

    attr_reader :port, :method, :path, :headers, :body

    def to_hash
      {
          'port' => port,
          'method' => method,
          'path' => path
      }
    end

    def self.extract_relevant_headers(environment)
      headers = Hash[environment
                         .select { |k, _| k.start_with?("HTTP_") && k != "HTTP_HOST"}
                         .map do |k, v|<commit_msg>Added body to request hash for spying<commit_after>module RestSpy
  class Request
    def initialize(port, method, path, headers, body=nil)
      @port = port
      @method = method.upcase
      @path = path
      @headers = headers
      @body = body
    end

    attr_reader :port, :method, :path, :headers, :body

    def to_hash
      {
          'port' => port,
          'method' => method,
          'path' => path,
          'body' => body
      }
    end

    def self.extract_relevant_headers(environment)
      headers = Hash[environment
                         .select { |k, _| k.start_with?("HTTP_") && k != "HTTP_HOST"}
                         .map do |k, v|
{'fraction_non_alphanumeric': 0.11633281972265024, 'fraction_numerical': 0.0, 'mean_word_length': 1.7638297872340425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '5272274', 'n_tokens_mistral': 396, 'n_tokens_neox': 381, 'n_words': 105}