<commit_before>require 'saorin/adapters/servers/base'
require 'rack'

module Saorin
  module Adapters
    module Servers
      class Rack < Base
        DEFAULT_HEADERS = {
          'Content-Type' => 'application/json'
        }

        def initialize(handler, options = {}, &block)
          super handler, options

          ::Rack::Server.start({
            :app => self
          }.merge(options))
        end

        def call(env)
          request = ::Rack::Request.new(env)
          response = ::Rack::Response.new([], 200, DEFAULT_HEADERS)
          response.write process_request(request.body.read) if request.post?
          response.finish
        end<commit_msg>fix host and port has not used in rack<commit_after>require 'saorin/adapters/servers/base'
require 'rack'

module Saorin
  module Adapters
    module Servers
      class Rack < Base
        DEFAULT_HEADERS = {
          'Content-Type' => 'application/json'
        }

        def initialize(handler, options = {}, &block)
          super handler, options

          ::Rack::Server.start({
            :app => self,
            :Host => options[:host],
            :Port => options[:port],
          }.merge(options))
        end

        def call(env)
          request = ::Rack::Request.new(env)
          response = ::Rack::Response.new([], 200, DEFAULT_HEADERS)
          response.write process_request(request.body.read) if request.post?
          response.finish
        end
{'fraction_non_alphanumeric': 0.11454046639231824, 'fraction_numerical': 0.00411522633744856, 'mean_word_length': 2.0332640332640333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1194099', 'n_tokens_mistral': 422, 'n_tokens_neox': 399, 'n_words': 95}