From 0385be0a0d2a808773a5b1d3781699cb6615692b Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 6 Mar 2026 19:39:55 +0000 Subject: [PATCH] Fix /results polling: use sx_response() for SX wire format The /results endpoint returns SX wire format but was sending it with content-type text/html. The SX engine couldn't process it, so raw s-expressions appeared as text and the browser tried to resolve quoted strings like "a.jpg" as URLs. Co-Authored-By: Claude Opus 4.6 --- test/bp/dashboard/routes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/bp/dashboard/routes.py b/test/bp/dashboard/routes.py index 3257d2c..aab19b5 100644 --- a/test/bp/dashboard/routes.py +++ b/test/bp/dashboard/routes.py @@ -89,6 +89,7 @@ def register(url_prefix: str = "/") -> Blueprint: async def results(): """HTMX partial — poll target for results table.""" from shared.browser.app.csrf import generate_csrf_token + from shared.sx.helpers import sx_response from sxc.pages.renders import render_results_partial_sx import runner @@ -104,10 +105,9 @@ def register(url_prefix: str = "/") -> Blueprint: active_service=active_service, ) - resp = Response(html, status=200, content_type="text/html") - # If still running, tell HTMX to keep polling + headers = {} if running: - resp.headers["HX-Trigger-After-Swap"] = "test-still-running" - return resp + headers["HX-Trigger-After-Swap"] = "test-still-running" + return sx_response(html, headers=headers) return bp