Sha256: 7896f5f0940c1a262a73080cf82029f274b13a78b3f6b4e671fd68d90973b76e
Contents?: true
Size: 667 Bytes
Versions: 34
Compression:
Stored size: 667 Bytes
Contents
module Rack::Insight class RedirectInterceptor include Render 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? && env["rack-insight.intercept_redirects"] intercept_redirect end @response.to_a end def intercept_redirect new_body = render_template("redirect", :redirect_to => @response.location) new_headers = { "Content-Type" => "text/html", "Content-Length" => new_body.size.to_s } @response = Rack::Response.new(new_body, 200, new_headers) end end end
Version data entries
34 entries across 34 versions & 1 rubygems