ludic/docs/language/http/http-text.md

548 B

id name category kind tokens sig tip order ns member
http-text Http.text http namespace-method Http.text Http.text(handle) -> str The response body as text. 11 Http text

Returns the response body as a NUL-terminated string: a copy that stays yours after Http.free lets the handle go, so read it once and keep what you read. Pair with Json.parse (#44) for JSON APIs.

program Demo {
  entry {
    let h = Http.get("https://example.com")
    if Http.poll(h) > 0 { print(Http.text(h)) }
  }
}