def open.as

bend-kit-hairpin@0.14.0.0 · hairpin.bend:458

import bend-kit-hairpin@0.14.0.0/hairpin.bend as Hairpin
import Base
import bend-kit-http@0.38.1.1/http.bend as Http
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-retry@0.3.0.0/retry.bend as Retry

458# A streamed request under the same budget, deadline, backoff, and breaker as request.as. The stream opens on
459# the client's pool. It follows the client's redirect mode, presents its certificate, and sends and stores
460# cookies through its jar, as request.as does. judge reads the status and headers through Http.stream.res.
461# A refused stream closes before the next attempt; the last one comes back open, so the caller can read its
462# body. Close it with stream.close to give its connection back to the pool.
463def open.as(~judge: Result<&1, &1, Http.Err, Http.Stream> -> Result<&1, &1, Http.Err, Http.Stream> & Verdict,
464    c: Client, b: Retry.Budget, +idem: Bool, +enc: String, +method: String, url: String,
465    headers: Map<&2, List<&2, String>>, body: Bytes.Bytes) -> IO(Client & Retry.Budget & Result<&1, &1, Err, Http.Stream>):
466  run(~Http.Stream, ~judge, ~try.stream, ~Http.stream.close, c, b, idem, enc, method, url, headers, body)

Uses (17)

Used by (1)