Skip to content

Commit

Permalink
fixup! Merge pull request #29 from Helithumper/27-payload_renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
jontyms committed Mar 28, 2024
1 parent 570c7f3 commit 7910bc2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util/limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def is_rate_limited(self, key: str, max_requests: int, window: int) -> bool:
def rate_limit(self, max_requests: int, window: int, request_path: str):
def decorator(func):
@wraps(func)
async def wrapper(request: Request, payload, *args, **kwargs):
payload = args[0]
user_id = payload.get("id")
async def wrapper(request: Request, user_jwt, *args, **kwargs):
user_jwt = args[0]
user_id = user_jwt.get("id")
if user_id is None:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
Expand All @@ -49,7 +49,7 @@ async def wrapper(request: Request, payload, *args, **kwargs):
status_code=status.HTTP_429_TOO_MANY_REQUESTS,
detail="Too many requests",
)
return await func(request=request, payload=payload, **kwargs)
return await func(request=request, user_jwt=user_jwt, **kwargs)

return wrapper

Expand Down

0 comments on commit 7910bc2

Please sign in to comment.