Skip to content

Commit

Permalink
Fix the indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
halorgium committed Oct 28, 2009
1 parent d3e0038 commit a226982
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/rack/client/follow_redirects.rb
@@ -1,27 +1,27 @@
class Rack::Client::FollowRedirects
include Rack::Test::Methods
include Rack::Test::Methods

def initialize(app)
@app = app
end
def initialize(app)
@app = app
end

def call(env)
status, headers, body = @app.call(env)
response = Rack::Response.new(body, status, headers)
if response.redirect?
uri = URI.parse(response["Location"])
new_env = {}
env.each do |k,v|
if %w| HTTP_HOST SERVER_NAME SERVER_PORT |.include?(k)
new_env[k] = v
end
def call(env)
status, headers, body = @app.call(env)
response = Rack::Response.new(body, status, headers)
if response.redirect?
uri = URI.parse(response["Location"])
new_env = {}
env.each do |k,v|
if %w| HTTP_HOST SERVER_NAME SERVER_PORT |.include?(k)
new_env[k] = v
end
new_env["REQUEST_METHOD"] = "GET"
session = Rack::Test::Session.new(@app)
env = session.send(:env_for, uri.to_s, new_env)
call(env)
else
[status, headers, body]
end
new_env["REQUEST_METHOD"] = "GET"
session = Rack::Test::Session.new(@app)
env = session.send(:env_for, uri.to_s, new_env)
call(env)
else
[status, headers, body]
end
end
end

0 comments on commit a226982

Please sign in to comment.