55import falcon
66import falcon .testing
77import sentry_sdk
8+ from sentry_sdk .consts import DEFAULT_MAX_VALUE_LENGTH
89from sentry_sdk .integrations .falcon import FalconIntegration
910from sentry_sdk .integrations .logging import LoggingIntegration
1011from sentry_sdk .utils import parse_version
@@ -207,9 +208,9 @@ def on_get(self, req, resp):
207208
208209
209210def test_falcon_large_json_request (sentry_init , capture_events ):
210- sentry_init (integrations = [FalconIntegration ()])
211+ sentry_init (integrations = [FalconIntegration ()], max_request_body_size = "always" )
211212
212- data = {"foo" : {"bar" : "a" * 2000 }}
213+ data = {"foo" : {"bar" : "a" * ( DEFAULT_MAX_VALUE_LENGTH + 10 ) }}
213214
214215 class Resource :
215216 def on_post (self , req , resp ):
@@ -228,9 +229,14 @@ def on_post(self, req, resp):
228229
229230 (event ,) = events
230231 assert event ["_meta" ]["request" ]["data" ]["foo" ]["bar" ] == {
231- "" : {"len" : 2000 , "rem" : [["!limit" , "x" , 1021 , 1024 ]]}
232+ "" : {
233+ "len" : DEFAULT_MAX_VALUE_LENGTH + 10 ,
234+ "rem" : [
235+ ["!limit" , "x" , DEFAULT_MAX_VALUE_LENGTH - 3 , DEFAULT_MAX_VALUE_LENGTH ]
236+ ],
237+ }
232238 }
233- assert len (event ["request" ]["data" ]["foo" ]["bar" ]) == 1024
239+ assert len (event ["request" ]["data" ]["foo" ]["bar" ]) == DEFAULT_MAX_VALUE_LENGTH
234240
235241
236242@pytest .mark .parametrize ("data" , [{}, []], ids = ["empty-dict" , "empty-list" ])
0 commit comments