Skip to content

Commit

Permalink
Interpret as JSON any mimetype ending with "json"
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Wang authored and patrickkwang committed Apr 10, 2021
1 parent c169258 commit d644c30
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions fastapi/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,9 @@ async def app(request: Request) -> Response:
else:
body_bytes = await request.body()
if body_bytes:
if (
request.headers.get(
"Content-Type", "application/octet-stream"
)
== "application/json"
):
if request.headers.get(
"Content-Type", "application/octet-stream"
).endswith("json"):
body = await request.json()
else:
body = body_bytes
Expand Down

0 comments on commit d644c30

Please sign in to comment.