405 method not allowed for GET to POST endpoints, closes #1916

This commit is contained in:
Simon Willison 2022-11-29 21:15:13 -08:00
commit 8404b21556
2 changed files with 26 additions and 1 deletions

View file

@ -922,3 +922,26 @@ async def test_create_table(ds_write, input, expected_status, expected_response)
assert response.status_code == expected_status
data = response.json()
assert data == expected_response
@pytest.mark.asyncio
@pytest.mark.parametrize(
"path",
(
"/data/-/create",
"/data/docs/-/drop",
"/data/docs/-/insert",
),
)
async def test_method_not_allowed(ds_write, path):
response = await ds_write.client.get(
path,
headers={
"Content-Type": "application/json",
},
)
assert response.status_code == 405
assert response.json() == {
"ok": False,
"error": "Method not allowed",
}