Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with flask url handler returning an iterator. #3755

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
7 changes: 6 additions & 1 deletion sentry_sdk/integrations/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,17 @@ def __call__(self, environ, start_response):
_sentry_start_response, start_response, transaction
),
)
if hasattr(response, "__iter__"):
scoped_response = _ScopedResponse(scope, response)
for it in scoped_response:
yield it
except BaseException:
reraise(*_capture_exception())
finally:
_wsgi_middleware_applied.set(False)

return _ScopedResponse(scope, response)
if not hasattr(response, "__iter__"):
return _ScopedResponse(scope, response)


def _sentry_start_response( # type: ignore
Expand Down
Loading