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:
|
if not run:
|
||||||
raise HTTPException(404, f"Run {run_id} not found")
|
raise HTTPException(404, f"Run {run_id} not found")
|
||||||
|
|
||||||
if wants_json(request):
|
# Only render HTML if browser explicitly requests it
|
||||||
return run
|
if wants_html(request):
|
||||||
|
templates = get_templates(request)
|
||||||
|
return render(templates, "runs/detail.html", request,
|
||||||
|
run=run,
|
||||||
|
active_tab="runs",
|
||||||
|
)
|
||||||
|
|
||||||
# Render HTML detail page
|
# Default to JSON for API clients
|
||||||
templates = get_templates(request)
|
return run
|
||||||
return render(templates, "runs/detail.html", request,
|
|
||||||
run=run,
|
|
||||||
active_tab="runs",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/{run_id}")
|
@router.delete("/{run_id}")
|
||||||
|
|||||||
Reference in New Issue
Block a user