Permalink
Browse files

Actually use the streamer in the UserInformer

  • Loading branch information...
1 parent 1e8fb0e commit d34b742dab0b9002c7201c86cd076e831c4d9ec4 @jyurek jyurek committed Jun 6, 2011
Showing with 1 addition and 7 deletions.
  1. +1 −6 lib/hoptoad_notifier/user_informer.rb
  2. +0 −1 test/user_informer_test.rb
@@ -11,12 +11,7 @@ def replacement(with)
def call(env)
status, headers, body = @app.call(env)
if env['hoptoad.error_id'] && HoptoadNotifier.configuration.user_information
- new_body = []
- body.each do |chunk|
- new_body << chunk.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id']))
- end
- headers['Content-Length'] = new_body.sum(&:length).to_s
- body = new_body
+ body = UserInformerStreamer.new(body, replacement(env['hoptoad.error_id']))
end
[status, headers, body]
end
@@ -12,7 +12,6 @@ class UserInformerTest < Test::Unit::TestCase
response = Net::HTTP.get_response(URI.parse("http://example.com/"))
assert_equal "Hoptoad Error 1", response.body
- assert_equal 15, response["Content-Length"].to_i
end
should "not modify output if there is no hoptoad id" do

0 comments on commit d34b742

Please sign in to comment.