Skip to content
Closed
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