From 18fdd8c62b12ccd25c4b85d16af6a76028e91b04 Mon Sep 17 00:00:00 2001 From: tompassarelli Date: Mon, 6 Apr 2026 17:33:30 +0700 Subject: [PATCH] Fix: default to status 200 for non-empty DatastarResponse (Litestar) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Litestar's Stream base class defaults to status 201 when no status_code is provided. Datastar's client-side fetch action (RC8) only processes SSE responses with status 200 — non-200 responses are silently discarded: // fetch.ts line 561 if (status !== 200) { dispose(); resolve(); return; } The empty-content case already defaults to 204. This adds the same pattern for the non-empty case: default to 200 when the caller doesn't specify a status code. --- src/datastar_py/litestar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/datastar_py/litestar.py b/src/datastar_py/litestar.py index 7492547..6e3590f 100644 --- a/src/datastar_py/litestar.py +++ b/src/datastar_py/litestar.py @@ -46,6 +46,7 @@ def __init__( status_code = status_code or 204 content = tuple() else: + status_code = status_code or 200 headers = {**self.default_headers, **(headers or {})} if isinstance(content, DatastarEvent): content = (content,)