<commit_before>require 'net/http'

module Sonic
  module Protocol
    class HTTP
      include Protocol::Base

      def initialize(service_checker)
        @service_checker = service_checker
        @http = Net::HTTP.new(service_checker.host, service_checker.port)
        if service_checker.protocol == :https
          @http.use_ssl = true
          @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end
        @request = Net::HTTP::Get.new(service_checker.path)
      end

      def get
        begin
          @service_checker.response = @http.request(@request)
          case @service_checker.response.code
          when '200', '201', '202', '203', '204', '205', '206'
            true
          else
            @service_checker.error = "service error"
            false
          end
        rescue Exception => e
          @service_checker.error = e.to_s
          false
        end
      end

    end
  end
end
<commit_msg>http response to body<commit_after>require 'net/http'

module Sonic
  module Protocol
    class HTTP
      include Protocol::Base

      def initialize(service_checker)
        @service_checker = service_checker
        @http = Net::HTTP.new(service_checker.host, service_checker.port)
        if service_checker.protocol == :https
          @http.use_ssl = true
          @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end
        @request = Net::HTTP::Get.new(service_checker.path)
      end

      def get
        begin
          @service_checker.response = @http.request(@request).body
          case @service_checker.response.code
          when '200', '201', '202', '203', '204', '205', '206'
            true
          else
            @service_checker.error = "service error"
            false
          end
        rescue Exception => e
          @service_checker.error = e.to_s
          false
        end
      end

    end
  end
end

{'fraction_non_alphanumeric': 0.09360126916975145, 'fraction_numerical': 0.0222104706504495, 'mean_word_length': 1.9062980030721965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7219596', 'n_tokens_mistral': 581, 'n_tokens_neox': 548, 'n_words': 125}