def upload.write
import bend-kit-http@0.38.2.0/http.bend as Httpimport Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
5494# One chunk. An empty piece sends nothing, since an empty chunk would end the body.
5495def upload.write(up: Up, piece: Bytes.Bytes) -> IO(Up & Result<&2, &2, Err, Unit>):
5496 Up{+tls, s, +ms, +head, err} = up
5497 match err:
5498 case Some{+e}:
5499 IO.pure(Up & Result<&2, &2, Err, Unit>, (Up{tls, s, ms, head, Some{e}}, Fail{e}))
5500 case None{}:
5501 up.chunk(tls, s, ms, head, piece)