Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use Rack::BodyProxy in AD::Reloader

  • Loading branch information...
commit 3ded9b3c26e7fc2684ba1200ae9263d821408545 1 parent f9f0f03
Sergey Nartimov lest authored
30 actionpack/lib/action_dispatch/middleware/body_proxy.rb
View
@@ -1,30 +0,0 @@
-# Keep this file meanwhile https://github.com/rack/rack/pull/313 is not released
-module ActionDispatch
- class BodyProxy
- def initialize(body, &block)
- @body, @block, @closed = body, block, false
- end
-
- def respond_to?(*args)
- super or @body.respond_to?(*args)
- end
-
- def close
- return if @closed
- @closed = true
- begin
- @body.close if @body.respond_to? :close
- ensure
- @block.call
- end
- end
-
- def closed?
- @closed
- end
-
- def method_missing(*args, &block)
- @body.__send__(*args, &block)
- end
- end
-end
6 actionpack/lib/action_dispatch/middleware/reloader.rb
View
@@ -1,5 +1,3 @@
-require 'action_dispatch/middleware/body_proxy'
-
module ActionDispatch
# ActionDispatch::Reloader provides prepare and cleanup callbacks,
# intended to assist with code reloading during development.
@@ -62,8 +60,10 @@ def initialize(app, condition=nil)
def call(env)
@validated = @condition.call
prepare!
+
response = @app.call(env)
- response[2] = ActionDispatch::BodyProxy.new(response[2]) { cleanup! }
+ response[2] = ::Rack::BodyProxy.new(response[2]) { cleanup! }
+
response
rescue Exception
cleanup!
Please sign in to comment.
Something went wrong with that request. Please try again.