@@ -182,10 +182,9 @@ def index():
182182 "" : {"len" : 2000 , "rem" : [["!len" , "x" , 509 , 512 ]]}
183183 }
184184 assert len (event ["request" ]["data" ]["foo" ]["bar" ]) == 512
185- assert event ["request" ]["data_info" ] == {"ct" : "json" , "repr" : "structured" }
186185
187186
188- def test_flask_large_formdata_request (sentry_init , capture_events , app ):
187+ def test_flask_medium_formdata_request (sentry_init , capture_events , app ):
189188 sentry_init (integrations = [flask_sentry .FlaskIntegration ()])
190189
191190 data = {"foo" : "a" * 2000 }
@@ -209,12 +208,11 @@ def index():
209208 "" : {"len" : 2000 , "rem" : [["!len" , "x" , 509 , 512 ]]}
210209 }
211210 assert len (event ["request" ]["data" ]["foo" ]) == 512
212- assert event ["request" ]["data_info" ] == {"ct" : "urlencoded" , "repr" : "structured" }
213211
214212
215213@pytest .mark .parametrize ("input_char" , [u"a" , b"a" ])
216- def test_flask_large_text_request (sentry_init , input_char , capture_events , app ):
217- sentry_init (integrations = [flask_sentry .FlaskIntegration ()])
214+ def test_flask_too_large_raw_request (sentry_init , input_char , capture_events , app ):
215+ sentry_init (integrations = [flask_sentry .FlaskIntegration ()], request_bodies = "small" )
218216
219217 data = input_char * 2000
220218
@@ -237,41 +235,13 @@ def index():
237235
238236 event , = events
239237 assert event ["" ]["request" ]["data" ] == {
240- "" : {"len" : 2000 , "rem" : [["!len" , "x" , 509 , 512 ]]}
241- }
242- assert len (event ["request" ]["data" ]) == 512
243- assert event ["request" ]["data_info" ] == {"ct" : "plain" , "repr" : "other" }
244-
245-
246- def test_flask_large_bytes_request (sentry_init , capture_events , app ):
247- sentry_init (integrations = [flask_sentry .FlaskIntegration ()])
248-
249- data = b"\xc3 " * 2000
250-
251- @app .route ("/" , methods = ["POST" ])
252- def index ():
253- assert not request .form
254- assert request .data == data
255- assert not request .json
256- capture_message ("hi" )
257- return "ok"
258-
259- events = capture_events ()
260-
261- client = app .test_client ()
262- response = client .post ("/" , data = data )
263- assert response .status_code == 200
264-
265- event , = events
266- assert event ["" ]["request" ]["data" ] == {
267- "" : {"len" : 2668 , "rem" : [["!len" , "x" , 509 , 512 ]]}
238+ "" : {"len" : 2000 , "rem" : [["!config" , "x" , 0 , 2000 ]]}
268239 }
269- assert len (event ["request" ]["data" ]) == 512
270- assert event ["request" ]["data_info" ] == {"ct" : "bytes" , "repr" : "base64" }
240+ assert not event ["request" ]["data" ]
271241
272242
273243def test_flask_files_and_form (sentry_init , capture_events , app ):
274- sentry_init (integrations = [flask_sentry .FlaskIntegration ()])
244+ sentry_init (integrations = [flask_sentry .FlaskIntegration ()], request_bodies = "always" )
275245
276246 data = {"foo" : "a" * 2000 , "file" : (BytesIO (b"hello" ), "hello.txt" )}
277247
0 commit comments