mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
Fix handling non-GET requests
The `request` parameter being passed in was just a hold-over from an earlier refactoring. Added tests to ensure that this edge case keeps working.
This commit is contained in:
@@ -95,6 +95,17 @@ async def pydantic_instance() -> Item:
|
||||
return Item(name="Something", description="An instance of a Pydantic model", price=10.5)
|
||||
|
||||
|
||||
put_ret = 0
|
||||
|
||||
|
||||
@app.put("/uncached_put")
|
||||
@cache(namespace="test", expire=5)
|
||||
async def uncached_put():
|
||||
global put_ret
|
||||
put_ret = put_ret + 1
|
||||
return {"value": put_ret}
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
FastAPICache.init(InMemoryBackend())
|
||||
|
||||
Reference in New Issue
Block a user