<commit_before>module Rack
  class ServeReactApp
    def initialize(app, _options = {})
      @app = app
    end

    def call(env)
      request = Rack::Request.new(env)
      if request.path.match?(/^\/beta/)
        headers = { 'content-type': 'text/html; charset=utf-8' }
        [200, headers, File.read(Rails.root.join('public', 'react', 'index.html'))]
      else
        @app.call(env)
      end
    end
  end
end<commit_msg>Fix rack middleware for serving react app<commit_after>module Rack
  class ServeReactApp
    def initialize(app, _options = {})
      @app = app
    end

    def call(env)
      request = Rack::Request.new(env)
      if request.path.match(/^\/beta/)
        headers = { 'content-type': 'text/html; charset=utf-8' }
        [200, headers, ::File.read(Rails.root.join('public', 'frontend', 'index.html'))]
      else
        @app.call(env)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.14810690423162584, 'fraction_numerical': 0.008908685968819599, 'mean_word_length': 2.4444444444444446, 'pattern_counts': {'":': 0, '<': 3, '<?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': '330715', 'n_tokens_mistral': 309, 'n_tokens_neox': 302, 'n_words': 67}