mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
Attach updated endpoint signature to inner
Not all endpoints accept a __signature__ attribute, nor should the cache decorator modify the decorated endpoint. Attach the signature to the returned inner function instead. While here, refactor the signature updating code, and extract it to a separate function.
This commit is contained in:
@@ -73,3 +73,9 @@ def test_kwargs() -> None:
|
||||
name = "Jon"
|
||||
response = client.get("/kwargs", params={"name": name})
|
||||
assert response.json() == {"name": name}
|
||||
|
||||
|
||||
def test_method() -> None:
|
||||
with TestClient(app) as client:
|
||||
response = client.get("/method")
|
||||
assert response.json() == 17
|
||||
|
||||
Reference in New Issue
Block a user