Module: Tipi::ResponseExtensions

Included in:
Qeweney::Request
Defined in:
lib/tipi/response_extensions.rb

Constant Summary collapse

SPLICE_CHUNKS_SIZE_THRESHOLD =
2**20

Instance Method Summary collapse

Instance Method Details

#serve_io(io, opts) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/tipi/response_extensions.rb', line 9

def serve_io(io, opts)
  if !opts[:stat] || opts[:stat].size >= SPLICE_CHUNKS_SIZE_THRESHOLD
    @adapter.respond_from_io(self, io, opts[:headers], opts[:chunk_size] || 2**14)
  else
    respond(io.read, opts[:headers] || {})
  end
end