Response (HTTP wrapper)
Type: Response
A small wrapper around HTTP response content returned by fetch()
.
Methods
json()
-> Dict[str, Any]- Parse JSON content and return a dictionary. Raises
ClypRuntimeError
on decoding errors.
- Parse JSON content and return a dictionary. Raises
content()
-> str- Return raw response content.
text()
-> str- Return content coerced to text.
Example
function example() returns null {
let resp = fetch("https://api.example.com/data");
let data = resp.json();
print(data);
}
Notes
This is intentionally small: it stores response text and exposes JSON
parsing with error translation into ClypRuntimeError
.