Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reading FastAPI request body twice. (#1724)
Starlette/FastAPI is internally caching the request body if read via request.json() or request.body() but NOT when using request.form(). This leads to a problem when our Sentry Starlette integration wants to read the body data and also the users code wants to read the same data. Solution: Force caching of request body for .form() calls too, to prevent error when body is read twice. The tests where mocking .stream() and thus hiding this problem. So the tests have been refactored to mock the underlying ._receive() function instead. Co-authored-by: hasier <hasier@users.noreply.github.com>
- Loading branch information
1 parent
0923d03
commit f222c9d
Showing
2 changed files
with
159 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f222c9d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sentry-python – ./
sentry-python-git-master-sdk-rangers.vercel.app
sentry-python-sdk-rangers.vercel.app
sentry-python.vercel.app