Module: Coolhand::NetHttpInterceptor::ResponseInterceptor

Defined in:
lib/coolhand/net_http_interceptor.rb

Overview

Response streaming interceptor nested under NetHttpInterceptor

Instance Method Summary collapse

Instance Method Details

#read_body(dest = nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/coolhand/net_http_interceptor.rb', line 9

def read_body(dest = nil, &block)
  return super unless block

  super do |chunk|
    Thread.current[:coolhand_stream_buffer] ||= +""
    Thread.current[:coolhand_stream_buffer] << chunk
    yield(chunk)
  end
end