Chapter 7

HTTP

Build requests, configure timeout and retry, and process responses.

Request pipeline

example.hhy
http.get("https://example.com/users")
    |> timeout(5s)
    |> retry({ count: 3, backoff: 200ms })
    |> send
    |> response_body
    |> parse_json
    |> print

http.get/post/put/delete create immutable RequestPlans; timeout and retry transform the plan; send performs the network effect. response_body validates status and returns text.

V1.0 boundaries

  • Query, header, body, proxy, and redirect options
  • Text and binary responses
  • 16 MiB default response-body limit
  • Dry-run prints a redacted plan without sending the request