Sha256: 3a4a7b99436232c2744e8ea1cddc4981cb5bad61df86e7d2c9ffe069d4aa9b94
Contents?: true
Size: 741 Bytes
Versions: 16
Compression:
Stored size: 741 Bytes
Contents
module Rack class Bug 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-bug.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 end
Version data entries
16 entries across 16 versions & 5 rubygems