class VCR::Middleware::Excon::StreamingResponseBodyReader
@private
server in order to record it.
accumulate the response as it streams back from the real HTTP
Wraps an Excon streaming ‘:response_block`, so that we can
def call(chunk, remaining_bytes, total_bytes)
- Private: -
def call(chunk, remaining_bytes, total_bytes) @chunks << chunk @response_block.call(chunk, remaining_bytes, total_bytes) end
def initialize(response_block)
def initialize(response_block) @response_block = response_block @chunks = [] end
def read_body_from(response_params)
- Private: -
def read_body_from(response_params) if @chunks.none? # Not sure why, but sometimes the body comes through the params # instead of via the streaming block even when the block was # configured. response_params[:body] else @chunks.join('') end end