def http.answer
import ezhttp@0.22.0.0/src/client.bend as Clientimport Base
import ezhttp@0.22.0.0/src/wire.bend as Wire
import ezhttp@0.22.0.0/src/wirespec.bend as Spec
import ezhttp@0.22.0.0/src/packed.bend as Packed
38# an exchange's answer as a client Response, read by the request's method
39# (packed.bend packed.reply: interim 1xx heads skipped, no body for HEAD, 1xx,
40# 204 or 304); a failed exchange keeps its reason (wirespec.bend wire.failed)
41def http.answer(+method: String, a: Wire.Answer) -> Response:
42 match a:
43 case Wire.Failed{answer}:
44 Err{Spec.wire.failed(answer)}
45 case Wire.Received{octets}:
46 from.got(Packed.packed.reply(method, octets))