Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-vincent committed Mar 17, 2020
1 parent 025b38d commit 8669fb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fastapi/routing.py
Expand Up @@ -127,8 +127,10 @@ async def app(request: Request) -> Response:
body = await request.form()
else:
body_bytes = await request.body()
if body_bytes:
if body_bytes and request.headers["Content-Type"] == "application/json":
body = await request.json()
else:
body = body_bytes
except Exception as e:
logger.error(f"Error getting request body: {e}")
raise HTTPException(
Expand Down

0 comments on commit 8669fb8

Please sign in to comment.