def body.shape

emerging-ezhttp@0.21.0.0 · src/body.bend:25

import emerging-ezhttp@0.21.0.0/src/body.bend as Body
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

25# a body as its shape and the octets sent after the request text: a text
26# body's are none, and the empty body is the empty text
27def body.shape(b: Body) -> Shape & Bytes.Bytes:
28  match b:
29    case Empty{}:
30      (ShapeText{""}, Bytes.new(0))
31    case Plain{text}:
32      (ShapeText{text}, Bytes.new(0))
33    case Octets{bytes}:
34      body.sized(Bytes.length(bytes))

Uses (8)

Used by (2)