def open.as

bend-kit-hairpin@0.13.0.1 · hairpin.bend:469

import bend-kit-hairpin@0.13.0.1/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.2.0.0/retry.bend as Retry

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

Uses (17)

Used by (1)