def wire.loop.judge

emerging-ezhttp@0.21.0.0 · src/wire.bend:114

import emerging-ezhttp@0.21.0.0/src/wire.bend as Wire
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
import emerging-ezhttp@0.21.0.0/src/wirespec.bend as Spec
import emerging-ezhttp@0.21.0.0/src/http.bend as Http

114# a read judged by its count when that decides it (SPEC.md HTTP-CLI-6)
115def wire.loop.judge(+secure: Bool, s: Socket, h: Http.Hear, piece: Bytes.Bytes,
116  acc: Bytes.Bytes, counted: Maybe<&2, Spec.Read>,
117  more: Socket -> Http.Hear -> Bytes.Bytes -> IO(Answer)) -> IO(Answer):
118  match counted:
119    case Some{r}:
120      wire.loop.on(secure, s, r, Bytes.append(acc, piece), more)
121    case None{}:
122      wire.loop.text(secure, s, h, piece, acc, more)

Uses (11)

Used by (1)