def upload.finish

bend-kit-http@0.38.2.0 · http.bend:5503

import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

5503# Ends the body and returns the response as a stream.
5504def upload.finish(up: Up) -> IO(Result<&1, &1, Err, Stream>):
5505  Up{+tls, s, +ms, +head, err} = up
5506  match err:
5507    case Some{e}:
5508      do IO<Result<&1, &1, Err, Stream>>:
5509        io.close(tls, s)
5510        return Fail{e}
5511    case None{}:
5512      do IO<Result<&1, &1, Err, Stream>>:
5513        sent : Socket & Result<&1, &1, U32 & String, Unit> <- io.send.bytes(tls, s, Bytes.from_string("0\r\n\r\n"))
5514        x : Bool & Result<&1, &1, Err, Stream> <- stream.sent(tls, ms, head, None{}, sent)
5515        return stream.opened(x)

Uses (19)

Used by (1)