From 50ea0f14913f2bca7f69376b848415c20716d139 Mon Sep 17 00:00:00 2001 From: gilesb Date: Sun, 11 Jan 2026 22:03:53 +0000 Subject: [PATCH] Fix run detail: default to JSON, only HTML if browser requests it API clients like Python requests send Accept: */* which wasn't matching wants_json(). Switch to checking wants_html() instead so API clients get JSON by default. Co-Authored-By: Claude Opus 4.5 --- app/routers/runs.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/routers/runs.py b/app/routers/runs.py index 958e223..078f0df 100644 --- a/app/routers/runs.py +++ b/app/routers/runs.py @@ -100,15 +100,16 @@ async def get_run( if not run: raise HTTPException(404, f"Run {run_id} not found") - if wants_json(request): - return run + # Only render HTML if browser explicitly requests it + if wants_html(request): + templates = get_templates(request) + return render(templates, "runs/detail.html", request, + run=run, + active_tab="runs", + ) - # Render HTML detail page - templates = get_templates(request) - return render(templates, "runs/detail.html", request, - run=run, - active_tab="runs", - ) + # Default to JSON for API clients + return run @router.delete("/{run_id}")