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):
145
145
operation_type = "query"
146
146
op = OP .GRAPHQL_QUERY
147
147
148
+ if self .execution_context .query is None :
149
+ self .execution_context .query = ""
150
+
148
151
if self .execution_context .query .strip ().startswith ("mutation" ):
149
152
operation_type = "mutation"
150
153
op = OP .GRAPHQL_MUTATION
Original file line number Diff line number Diff line change @@ -600,3 +600,30 @@ def test_transaction_mutation(
600
600
"graphql.path" : "change" ,
601
601
}
602
602
)
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