Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Thin::Response # This class specifies it's own each method which yields multiple times.
- def each
- yield head # Once for the status/headers
- if @body.is_a?(String)
- yield @body # Again if the response body is a String
- else
- @body.each { |chunk| yield chunk } # And it enumerates over anything else.
- end # This is the place to hook into.
- end
- end
- # This is the block getting yielded to!
- @response.each do |chunk|
- trace { chunk }
- send_data chunk
- end
Add Comment
Please, Sign In to add comment