File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
tests/integrations/strawberry Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ def on_operation(self):
145145 operation_type = "query"
146146 op = OP .GRAPHQL_QUERY
147147
148+ if self .execution_context .query is None :
149+ self .execution_context .query = ""
150+
148151 if self .execution_context .query .strip ().startswith ("mutation" ):
149152 operation_type = "mutation"
150153 op = OP .GRAPHQL_MUTATION
Original file line number Diff line number Diff line change @@ -600,3 +600,30 @@ def test_transaction_mutation(
600600 "graphql.path" : "change" ,
601601 }
602602 )
603+
604+
605+ @parameterize_strawberry_test
606+ def test_handle_none_query_gracefully (
607+ request ,
608+ sentry_init ,
609+ capture_events ,
610+ client_factory ,
611+ async_execution ,
612+ framework_integrations ,
613+ ):
614+ sentry_init (
615+ integrations = [
616+ StrawberryIntegration (async_execution = async_execution ),
617+ ]
618+ + framework_integrations ,
619+ )
620+ events = capture_events ()
621+
622+ schema = strawberry .Schema (Query )
623+
624+ client_factory = request .getfixturevalue (client_factory )
625+ client = client_factory (schema )
626+
627+ client .post ("/graphql" , json = {})
628+
629+ assert len (events ) == 0 , "expected no events to be sent to Sentry"
You can’t perform that action at this time.
0 commit comments