def enc.part

bend-kit-multipart@0.3.0.0 · multipart.bend:259

import bend-kit-multipart@0.3.0.0/multipart.bend as Multipart
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

259# The pieces so far, latest first. A body cannot hold CRLF "--" boundary; bchars hold no CR,
260# so the delimiter cannot start inside the body and end in the one after it.
261def enc.part(acc: Result<&1, &1, String, List<&1, Bytes.Bytes>>, p: Part, +b: String, +delim: String) -> Result<&1, &1, String, List<&1, Bytes.Bytes>>:
262  match acc:
263    case Fail{e}:
264      Fail{e}
265    case Done{xs}:
266      Part{name, fname, +ct, body} = p
267      enc.body(enc.ctype.ok(ct), Bytes.find(body, delim), enc.head(b, name, fname, ct), xs)

Uses (9)

Used by (1)