def encode.pick

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

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

1694# RFC 9110 §6.4.1, §8.6: 1xx, 204 and 304 have no body; HEAD gets the length but no body.
1695def encode.pick(+status: U32, headers: Map<&2, List<&2, String>>, body: Bytes.Bytes, head: Bool, nobody: Bool) -> Bytes.Bytes:
1696  match nobody:
1697    case True{}:
1698      Bytes.from_string(response(status, headers, ""))
1699    case False{}:
1700      encode.len(status, headers, head, body)

Uses (9)

Used by (1)