def config

cswap-bend-cli@0.1.0.0 · http.bend:49

import cswap-bend-cli@0.1.0.0/http.bend as Http
import Base

49# curl config for one request. `dump-header = -` puts the response headers on
50# stdout ahead of the body; `write-out` appends the HTTP status as the last
51# line. An empty body sends no data line (a GET stays a GET).
52def config(method: String, url: String, hs: List<(String & String)>, body: String, timeout_s: U32) -> String:
53  line("url", url)
54    ++ line("request", method)
55    ++ "silent\nshow-error\ndump-header = -\n"
56    ++ line("max-time", U32.show(timeout_s))
57    ++ line("write-out", "\\n%{http_code}")
58    ++ headers(hs)
59    ++ body.line(body)

Uses (9)

Used by (4)