Jun 2025 (v0.3.5)
Mochi v0.3.5 introduces a new fetch expression for performing HTTP requests.
Responses are decoded into typed values, and optional with parameters allow
setting the HTTP method, headers, and body. The interpreter ships with a simple
HTTP helper and the Python and TypeScript compilers now emit fetch support.
Fetch Expression
type Todo {
userId: int
id: int
title: string
completed: bool
}
let todo: Todo = fetch "https://example.com/todos/1"
let created: Todo = fetch "https://example.com/todos" with {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: todo
}
Other Changes
- Type checking for fetch options
- Python and TypeScript compilers support
fetch - Runtime HTTP helper for the interpreter