<commit_before>require 'webrat/rack'
require 'sinatra'
require 'sinatra/test/methods'

disable :run
disable :reload

module Webrat
  class SinatraSession < RackSession #:nodoc:
    include Sinatra::Test::Methods
    
    attr_reader :request, :response

    %w(get head post put delete).each do |verb|
      define_method(verb) do |*args| # (path, data, headers = nil)
        path, data, headers = *args
        params = data.merge(:env => headers || {})
        self.__send__("#{verb}_it", path, params)
        get_it(@response.location, params) while @response.redirect?
      end
    end
  end
end<commit_msg>Use request_page to handle sinatra redirects<commit_after>require 'webrat/rack'
require 'sinatra'
require 'sinatra/test/methods'

disable :run
disable :reload

module Webrat
  class SinatraSession < RackSession #:nodoc:
    include Sinatra::Test::Methods
    
    attr_reader :request, :response

    %w(get head post put delete).each do |verb|
      define_method(verb) do |*args| # (path, data, headers = nil)
        path, data, headers = *args
        params = data.merge(:env => headers || {})
        self.__send__("#{verb}_it", path, params)
        request_page(@response.location, :get, {}) while @response.redirect?
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12154696132596685, 'fraction_numerical': 0.0, 'mean_word_length': 3.418118466898955, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2186541', 'n_tokens_mistral': 396, 'n_tokens_neox': 394, 'n_words': 110}