mirror of
https://github.com/simonw/datasette.git
synced 2026-07-10 01:24:45 +02:00
Row update return:true responds with rows list, matching insert/upsert
Row update previously returned a singular "row" object where insert and upsert return a "rows" list. All write endpoints now use "rows". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GrHZSypDfMnym1tM5XJAFZ
This commit is contained in:
parent
6488b7a30e
commit
b09dceea88
7 changed files with 40 additions and 13 deletions
|
|
@ -507,3 +507,27 @@ async def test_query_html_without_sql_is_still_the_editor(ds_client):
|
|||
response = await ds_client.get("/fixtures/-/query")
|
||||
assert response.status_code == 200
|
||||
assert response.headers["content-type"].startswith("text/html")
|
||||
|
||||
|
||||
# Write API return:true responses use "rows" consistently
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_row_update_return_uses_rows_list(ds_error_shape):
|
||||
await ds_error_shape.client.post(
|
||||
"/data/docs/-/insert",
|
||||
json={"row": {"id": 1, "title": "One"}},
|
||||
headers={"Content-Type": "application/json"},
|
||||
actor={"id": "root"},
|
||||
)
|
||||
response = await ds_error_shape.client.post(
|
||||
"/data/docs/1/-/update",
|
||||
json={"update": {"title": "Updated"}, "return": True},
|
||||
headers={"Content-Type": "application/json"},
|
||||
actor={"id": "root"},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["ok"] is True
|
||||
assert "row" not in data
|
||||
assert data["rows"] == [{"id": 1, "title": "Updated"}]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue