def upload.finish

bend-kit-http@0.38.5.0 · http.bend:5495

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

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

Uses (19)

Used by (1)