Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Interpret as JSON any mimetype ending with "json"
  • Loading branch information
Patrick Wang authored and patrickkwang committed Apr 10, 2021
commit d644c3060befbd211994d047a3b6b3ee0f6ba8e9
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