Skip to content

Commit 412020b

Browse files
committed
feat(mypyc): prevent uninitialized declaration
1 parent 13b7849 commit 412020b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/fastapi_csrf_protect/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ async def validate_csrf(
180180
raise MissingTokenError("Form data must be of type string")
181181
token = form_data
182182
else:
183-
token = self.get_csrf_from_body(await request.body())
183+
body: bytes = await request.body()
184+
token = self.get_csrf_from_body(body)
184185
serializer = URLSafeTimedSerializer(secret_key, salt="fastapi-csrf-token")
185186
try:
186187
signature: str = serializer.loads(signed_token, max_age=time_limit)

0 commit comments

Comments
 (0)