Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions sentry_sdk/integrations/fastapi.py
Original file line number Diff line number Diff line change
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
11 changes: 10 additions & 1 deletion sentry_sdk/integrations/starlette.py
Original file line number Diff line number Diff line change
@@ -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 @@ -41,6 +40,12 @@
# Startlette 0.19.1
from starlette.exceptions import ExceptionMiddleware # type: ignore

try:
# Optional dependency of Starlette to parse form data.
import multipart # type: ignore # noqa: F401
except ImportError:
multipart = None


_DEFAULT_TRANSACTION_NAME = "generic Starlette request"

Expand Down Expand Up @@ -339,6 +344,9 @@ 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
"""
if multipart is None:
return None

return await self.request.form()

def is_json(self):
Expand Down Expand Up @@ -423,6 +431,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
Copy Markdown

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