def http.send.timed

emerging-ezhttp@0.21.0.0 · src/client.bend:71

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

71# an exchange as wirespec.bend wrote it, bounded by a timeout, sent and read
72# by its own method
73def http.send.timed(ms: U32, ex: Spec.Exchange, tail: Bytes.Bytes)
74  -> IO(Response):
75  match ex:
76    case Spec.NoUrl{why}:
77      IO.pure(Response, Err{why})
78    case Spec.Exchange{secure, host, port, +method, req}:
79      do IO<Response>:
80        a : Wire.Answer <- Wire.wire.talk.timed(secure, ms, host, port, method,
81          req, tail)
82        IO.pure(Response, http.answer(method, a))

Uses (10)

Used by (1)