-
Notifications
You must be signed in to change notification settings - Fork 326
Open
Labels
Description
Per the documentation, it should be possible to pass a an each block to body to stream:
require 'http'
response = HTTP.get('https://news.ycombinator.com')
response.body.each { |chunk| puts(chunk) }This works as expected. However, if logging is used then an HTTP::StateError is raised:
require 'http'
require 'logger'
logger = Logger.new($stdout)
response = HTTP.use({ logging: { logger: logger }}).get('https://news.ycombinator.com')
response.body.each { |chunk| puts(chunk) }
# raises: http/response/body.rb:67:in `stream!': body has already been consumed (HTTP::StateError)wilsonsilva