def upload.write
import bend-kit-http@0.38.5.0/http.bend as Httpimport Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
5486# One chunk. An empty piece sends nothing, since an empty chunk would end the body.
5487def upload.write(up: Up, piece: Bytes.Bytes) -> IO(Up & Result<&2, &2, Err, Unit>):
5488 Up{+tls, s, +ms, +head, err} = up
5489 match err:
5490 case Some{+e}:
5491 IO.pure(Up & Result<&2, &2, Err, Unit>, (Up{tls, s, ms, head, Some{e}}, Fail{e}))
5492 case None{}:
5493 up.chunk(tls, s, ms, head, piece)