<commit_before>module Spy
  class Switcher
    def initialize(app)  
      @app = app  
    end  
      
    def call(env)  
      status, headers, response = @app.call(env)
      return [status, headers, response] unless response.respond_to?(:body)

      if env['warden'].authenticated?(Spy.admin_scope) and status == 200
        users = User.all.map do |u|
          selected = env['warden'].user == u ? 'selected' : ''
          "<option value=#{u.id} #{selected}>#{u}</option>"
        end.unshift("<option>[choose]</option>").join

        if env['warden'].user
          logout_text = "| <a href='/users/sign_out'>logout user</a>"
        end
<commit_msg>need to check for body= as well<commit_after>module Spy
  class Switcher
    def initialize(app)  
      @app = app  
    end  
      
    def call(env)  
      status, headers, response = @app.call(env)
      return [status, headers, response] unless response.respond_to?(:body) and response.respond_to?(:body=)

      if env['warden'].authenticated?(Spy.admin_scope) and status == 200
        users = User.all.map do |u|
          selected = env['warden'].user == u ? 'selected' : ''
          "<option value=#{u.id} #{selected}>#{u}</option>"
        end.unshift("<option>[choose]</option>").join

        if env['warden'].user
          logout_text = "| <a href='/users/sign_out'>logout user</a>"
        end

{'fraction_non_alphanumeric': 0.15781818181818183, 'fraction_numerical': 0.004363636363636364, 'mean_word_length': 2.5463917525773194, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '614905', 'n_tokens_mistral': 449, 'n_tokens_neox': 438, 'n_words': 98}