def http.send

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

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

48# an exchange as wirespec.bend wrote it, with the body's octets after it:
49# sent and read by its own method, or the URL's reason
50def http.send(ex: Spec.Exchange, tail: Bytes.Bytes) -> IO(Response):
51  match ex:
52    case Spec.NoUrl{why}:
53      IO.pure(Response, Err{why})
54    case Spec.Exchange{secure, host, port, +method, req}:
55      do IO<Response>:
56        a : Wire.Answer <- Wire.wire.talk(secure, host, port, method, req, tail)
57        IO.pure(Response, http.answer(method, a))

Uses (9)

Used by (1)