From 492378c2a081fedabc1e2fd26bcc0b4ed50f2f83 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 14 Aug 2024 21:37:40 -0700 Subject: [PATCH] Test for application/json; charset=utf-8 Refs #2384, #2392 --- tests/test_api_write.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_api_write.py b/tests/test_api_write.py index b442113ba7..9c2b9b4584 100644 --- a/tests/test_api_write.py +++ b/tests/test_api_write.py @@ -37,12 +37,22 @@ def _headers(token): @pytest.mark.asyncio -async def test_insert_row(ds_write): +@pytest.mark.parametrize( + "content_type", + ( + "application/json", + "application/json; charset=utf-8", + ), +) +async def test_insert_row(ds_write, content_type): token = write_token(ds_write) response = await ds_write.client.post( "/data/docs/-/insert", json={"row": {"title": "Test", "score": 1.2, "age": 5}}, - headers=_headers(token), + headers={ + "Authorization": "Bearer {}".format(token), + "Content-Type": content_type, + }, ) expected_row = {"id": 1, "title": "Test", "score": 1.2, "age": 5} assert response.status_code == 201