def request

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

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

495# url resolves against the base; headers go over the defaults. Redirects follow the client's mode, at most 20.
496# Each request gets a fresh budget from budget(c). Before each attempt the deadline, the
497# budget, and the breaker must admit it. GET, HEAD, OPTIONS, TRACE, PUT, and DELETE try again after a connect
498# error, a timeout, or 408, 429, 500, 502, 503, or 504, as Http.retry.judge says, on the same pool.
499# When the attempts run out, the last result comes back; when none started, ErrDenied says why.
500def request(c: Client, +method: String, url: String, headers: Map<&2, List<&2, String>>, body: Bytes.Bytes) ->
501    IO(Client & Result<&1, &1, Err, Http.Res>):
502  do IO<Client & Result<&1, &1, Err, Http.Res>>:
503    y : Client & Retry.Budget <- budget(c)
504    x : Client & Retry.Budget & Result<&1, &1, Err, Http.Res> <- request.budget(method, url, headers, body, y)
505    return request.drop(x)

Uses (16)

Used by (4)