fix(backend): default GET list endpoints to JSON per spec 6.2

Spec 6.2 says: 'Default JSON response wraps the same data in a
{items, total, returned, has_more} envelope so the frontend can
paginate uniformly.' Previously the GET list endpoints defaulted
to NDJSON (consistent with the parse endpoints), which forced
every curl call to set Accept: application/json.

Now NDJSON is strictly opt-in via Accept: application/x-ndjson;
JSON is the default. Parse endpoints keep their existing NDJSON
default (browser uploads).

T8 test 'test_claims_default_accept_returns_ndjson' updated to
assert the new default.
This commit is contained in:
Tyler
2026-06-19 19:32:45 -06:00
parent 07ceeaf4cd
commit 300522aac1
2 changed files with 17 additions and 14 deletions
+8 -3
View File
@@ -278,7 +278,12 @@ def test_claims_ndjson_wins_over_json_when_both_accepted(seeded_store):
assert resp.headers["content-type"].startswith("application/x-ndjson")
def test_claims_default_accept_returns_ndjson(seeded_store):
"""No Accept header → NDJSON (consistent with parse endpoints' default)."""
def test_claims_default_accept_returns_json(seeded_store):
"""No Accept header → JSON envelope (per spec 6.2: JSON is the default for
list endpoints; NDJSON is the opt-in)."""
resp = seeded_store.get("/api/claims")
assert resp.headers["content-type"].startswith("application/x-ndjson")
body = resp.json()
assert "items" in body
assert "total" in body
assert "returned" in body
assert "has_more" in body