module Turbopuffer::Internal::Util

def write_multipart_content(y, val:, closing:, content_type: nil)

Parameters:
  • content_type (String, nil) --
  • closing (Array) --
  • val (Object) --
  • y (Enumerator::Yielder) --

Other tags:
    Api: - private
def write_multipart_content(y, val:, closing:, content_type: nil)
t_line = "Content-Type: %s\r\n\r\n"
al
bopuffer::FilePart
rn write_multipart_content(

l: val.content,
osing: closing,
ntent_type: val.content_type
hname
 format(content_line, content_type || "application/octet-stream")
 val.open(binmode: true)
ing << io.method(:close)
opy_stream(io, y)
 format(content_line, content_type || "application/octet-stream")
opy_stream(val, y)
ingIO
 format(content_line, content_type || "application/octet-stream")
 val.string
{ primitive?(_1) }
 format(content_line, content_type || "text/plain")
 val.to_s
 format(content_line, content_type || "application/json")
 JSON.generate(val)
\r\n"