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

Fixed problem with broken response #1516

Merged
merged 5 commits into from Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions sentry_sdk/integrations/fastapi.py
Expand Up @@ -96,6 +96,7 @@ async def __call__(self, scope, receive, send):
hub = Hub.current
integration = hub.get_integration(FastApiIntegration)
if integration is None:
await self.app(scope, receive, send)
return

with hub.configure_scope() as sentry_scope:
Expand Down
8 changes: 7 additions & 1 deletion sentry_sdk/integrations/starlette.py
@@ -1,6 +1,5 @@
from __future__ import absolute_import


from sentry_sdk._compat import iteritems
from sentry_sdk._types import MYPY
from sentry_sdk.hub import Hub, _should_send_default_pii
Expand Down Expand Up @@ -339,6 +338,12 @@ async def form(self):
curl -X POST http://localhost:8000/upload/somethign -H "Content-Type: application/x-www-form-urlencoded" -d "username=kevin&password=welcome123"
curl -X POST http://localhost:8000/upload/somethign -F username=Julian -F password=hello123
"""
try:
antonpirker marked this conversation as resolved.
Show resolved Hide resolved
# Optional dependency of Starlette to parse form data.
import multipart # type: ignore # noqa: F401
antonpirker marked this conversation as resolved.
Show resolved Hide resolved
except ImportError:
return

return await self.request.form()

def is_json(self):
Expand Down Expand Up @@ -423,6 +428,7 @@ async def __call__(self, scope, receive, send):
hub = Hub.current
integration = hub.get_integration(StarletteIntegration)
if integration is None:
await self.app(scope, receive, send)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this -- v1.8.0 is ~unusable with POST requests Starlette without this change

return

with hub.configure_scope() as sentry_scope:
Expand Down