<commit_before>require 'webrick'
require 'json'

# This is the Webrick endpoint for
# serving requests down to the client
module Hshtg
  module Http
    class HttpEndpoint < WEBrick::HTTPServlet::AbstractServlet
      include Util::HshtgLogger

      def do_GET (request, response)
        @request  = request
        @response = response
        logger.info("GET #{@request.path} hit")

        if @request.path.downcase.include?('/top')
          handle_top_request

        elsif @request.path == '/'
          generic_response(code: 200, file: './html/index.html')

        elsif @request.path == '/live'
          generic_response(code: 200, file: './html/live.html')

        elsif @request.path == '/health'
          health_check_request

        else
          generic_response
        end
      end

      # Handle HEAD requests for health checks
      def do_HEAD (request, response)
        @request  = request
        @response = response
<commit_msg>GET request comment<commit_after>require 'webrick'
require 'json'

# This is the Webrick endpoint for
# serving requests down to the client
module Hshtg
  module Http
    class HttpEndpoint < WEBrick::HTTPServlet::AbstractServlet
      include Util::HshtgLogger

      # Handle GET requests 
      def do_GET (request, response)
        @request  = request
        @response = response
        logger.info("GET #{@request.path} hit")

        if @request.path.downcase.include?('/top')
          handle_top_request

        elsif @request.path == '/'
          generic_response(code: 200, file: './html/index.html')

        elsif @request.path == '/live'
          generic_response(code: 200, file: './html/live.html')

        elsif @request.path == '/health'
          health_check_request

        else
          generic_response
        end
      end

      # Handle HEAD requests for health checks
      def do_HEAD (request, response)
        @request  = request
        @response = response

{'fraction_non_alphanumeric': 0.09628120224146715, 'fraction_numerical': 0.006113092205807438, 'mean_word_length': 2.3063973063973062, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2990694', 'n_tokens_mistral': 564, 'n_tokens_neox': 532, 'n_words': 153}