sync:
called get, GET request 200
called post, POST request 200
called put, PUT request 200
DELETE request 405
async:
called get, GET request 200
called get, POST request 200
called get, PUT request 200
called get, DELETE request 200
expected output is
sync:
called get, GET request 200
called post, POST request 200
called put, PUT request 200
DELETE request 405
async:
called get, GET request 200
called post, POST request 200
called put, PUT request 200
DELETE request 405
TestClient
always calls theGET
routes, when routes are added usingfastapi.APIRouter().add_api_router()
no matter what method was requested.Execute the following program
output is
expected output is
Python versions tested: 3.10, 3.11, 3.12 fastapi: 0.104.1 async-asgi-testclient: 1.4.11