Permalink
Browse files

fixed bug where middleware DIDN'T ACTUALLY WORK, but tests were passing

  • Loading branch information...
1 parent e228231 commit 95a32645b4d229516da082f8e9d53861aad45b1e madlep committed May 17, 2009
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/made_in_railscamp.rb
View
6 lib/made_in_railscamp.rb
@@ -21,11 +21,11 @@ def call(env)
def say_made_at_railscamp!(body, headers)
calc_content_length = headers.include?('Content-Length')
new_content_length = 0
- new_body = body.inject([]) do |new_body_acc, body_part|
+ new_body = []
+ body.each do |body_part|
new_body_part = body_part.gsub(/<\/body>/, "#{@message}</body>")
- new_body_acc << new_body_part
+ new_body << new_body_part
new_content_length += Rack::Utils.bytesize(new_body_part) if calc_content_length
- new_body_acc
end
if calc_content_length

0 comments on commit 95a3264

Please sign in to comment.