Skip to content

Commit

Permalink
Avoid popping from empty list
Browse files Browse the repository at this point in the history
Refs #21
  • Loading branch information
ricardogsilva authored Aug 15, 2024
1 parent a18f7d0 commit dd7496b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion asgi_csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ async def _parse_form_urlencoded(receive):
more_body = message.get("more_body", False)

async def replay_receive():
return messages.pop(0)
if messages:
return messages.pop(0)
else:
return await receive()

return dict(parse_qsl(body.decode("utf-8"))), replay_receive

Expand Down

0 comments on commit dd7496b

Please sign in to comment.