C3 HTTP Request (C3Http)
C3Http is a lightweight nodeless replacement for HTTPRequest. It offers significant improvements in ergonomics, performance, and testability.
Here is a complete working example of how to use C3Http in a script:
extends Node2D
func _ready() -> void:
var res := await C3Http.request("https://jsonplaceholder.typicode.com/todos/1")
if res.ok:
print(res.body.get_string_from_utf8()) # .body is PackedStringArray
print(res.text) # .text is String
print(res.json["title"]) # .json is Variant
else:
print(res.error) # "[http] status=404 Request failed with status 404."
print(res.error.status) # 404
Features
- Static
await-ablerequest()callable from any script — noNodeto add or configure - Every call returns a typed
Responseobject — a singleif not res.okcheck covers transport failures, timeouts, and non-2xx statuses alike - Per-request
Optionsthat mirrorHTTPRequest's properties (use_threads,accept_gzip, etc.), plus additional features - HTTP keep-alive — set
Options.sessionto pool and reuse connections across calls to the same host - Server-Sent Events (SSE) — pass an
on_sse_eventcallback to consume a streamingtext/event-streamresponse incrementally, with theLast-Event-IDcursor andretry:backoff surfaced for reconnects - Download progress — pass an
on_progresscallback to track(bytes_received, total_bytes)as the body arrives - Cancellation token — cancel an in-flight request from another coroutine or signal handler
- Connection status — pass an
on_status_changedcallback to observe theHTTPClientlifecycle (resolving, connecting, requesting, body) - Built-in test mock —
C3Http.Mockintercepts all requests in tests without a network, with stubs to configure responses and a call log for assertions
Comparison with HTTPRequest
| Feature | C3Http |
HTTPRequest |
|---|---|---|
| No Node to add or configure | ✅ | ❌ |
await-able (no signal wiring) |
✅ | ❌ |
Single ok check (transport + non-2xx) |
✅ | ❌ |
Decoded text body accessor |
✅ | ❌ |
Parsed json body accessor |
✅ | ❌ |
| Server-Sent Events (SSE) streaming | ✅ | ❌ |
Typed RequestError with Kind |
✅ | ❌ |
| Built-in test mock | ✅ | ❌ |
| HTTP keep-alive and connection reuse | ✅ | ❌ |
| Cancellation | ✅ | ✅ |
| Timeout | ✅ | ✅ |
| Gzip decompression | ✅ | ✅ |
| Redirect following | ✅ | ✅ |
| Download to file | ✅ | ✅ |
| Body size limit | ✅ | ✅ |
| Custom TLS options | ✅ | ✅ |
| Raw request body (bytes) | ✅ | ✅ |
| HTTP/HTTPS proxy | ✅ | ✅ |
| Download progress events | ✅ | ✅ |
| Connection status checking | ✅ | ✅ |
| Threaded requests (off main loop) | ✅ | ✅ |
Compatibility
Tested on Godot 4.7.x with automated (GUT) and manual tests. Manually verified to work back to Godot 4.2.0.
Installation
Click the "Asset Store" tab at the top of the Godot editor and search for "C3 HTTP Request". Then click "Download" and "Install". The addon will be automatically added to your project, and C3Http will be available as a global class immediately — no plugin activation required.
Alternatively, download the latest release from GitHub and copy the addons/c3_http_request folder into your project's addons/ directory.