Skip to content

Commit

Permalink
Force response_body method return String.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgn21st committed Dec 17, 2013
1 parent 1f45844 commit 3c75919
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/rack/honeypot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,9 @@ def call(env)
private

def response_body(response)
if response.respond_to?(:body)
response.body
elsif response.is_a?(String)
response
elsif response.respond_to?(:each)
body = ""
response.each { |part| body << part }
body
end
body = response.respond_to?(:body) ? response.body : response
body = body.inject("") { |i, a| i << a } if body.respond_to?(:each)
body.to_s
end

def spambot_submission?(form_hash)
Expand Down

0 comments on commit 3c75919

Please sign in to comment.