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 <noreply@anthropic.com>
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user