Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes issue where causing some rackapps to fail. problem is that not …

…all responses respond to #first.
  • Loading branch information...
commit 4c355a37aeac8bc91f8413ccbcb0e9846d09d16a 1 parent 110a54d
@aishfenton aishfenton authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/rack/webconsole/assets.rb
View
11 lib/rack/webconsole/assets.rb
@@ -24,6 +24,8 @@ def initialize(app)
# @param [Hash] env a Rack request environment.
def call(env)
status, headers, response = @app.call(env)
+ response.extend(ResponseMethods)
+
return [status, headers, response] unless check_html?(headers, response) && status == 200
if response.respond_to?(:body)
@@ -69,5 +71,14 @@ def check_html?(headers, response)
body =~ %r{<html.*</html>}m
end
end
+
+ module ResponseMethods
+ def first
+ obj = nil
+ self.each { |e| obj = e; break }
+ obj
+ end
+ end
+
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.