class Stripe::StripeClient

def execute_request_stream(method, path,

with the response body.
passed, then a StripeStreamResponse is returned containing an IO stream
block is expected to do all the necessary body processing. If no block is
If a block is passed, a StripeHeadersOnlyResponse is returned as the

with the body chunks read from the socket.
A `read_body_chunk` block can be passed, which will be called repeatedly

an arbitrary binary response.
it to a StripeObject. This should be used for any request where we expect
Executes a request and returns the body as a stream instead of converting
def execute_request_stream(method, path,
                           api_base: nil, api_key: nil, usage: [],
                           headers: {}, params: {},
                           &read_body_chunk_block)
  unless block_given?
    raise ArgumentError,
          "execute_request_stream requires a read_body_chunk_block"
  end
  http_resp, api_key = execute_request_internal(
    method, path, api_base, api_key, headers, params, usage, &read_body_chunk_block
  )
  # When the read_body_chunk_block is given, we no longer have access to the
  # response body at this point and so return a response object containing
  # only the headers. This is because the body was consumed by the block.
  resp = StripeHeadersOnlyResponse.from_net_http(http_resp)
  [resp, api_key]
end