@@ -71,26 +71,28 @@ async def test_post_request_sanity(self):
71
71
72
72
async def test_post_request_invalid_utf8 (self ):
73
73
Configuration ().payloads_enabled = True
74
- data_to_send = b'/">Miso\xdf NoContinuation'
75
- async with aiohttp .client .request (
76
- method = "POST" ,
77
- url = self .http_url_sanity ,
78
- headers = self .request_headers (),
79
- chunked = True ,
80
- data = data_to_send ,
81
- ) as resp :
82
- self ._assert_basic_attributes_and_headers (resp )
83
- spans = self .memory_exporter .get_finished_spans ()
84
- span = spans [0 ]
85
-
86
- self .assertEqual (
87
- span .attributes [SemanticAttributes .HTTP_REQUEST_BODY ],
88
- str (data_to_send ),
89
- )
90
- self .assertEqual (
91
- span .attributes [SemanticAttributes .HTTP_RESPONSE_BODY ],
92
- self .response_body (),
93
- )
74
+ with self .assertLogs () as logs_written :
75
+ data_to_send = b'/">Miso\xdf NoContinuation'
76
+ async with aiohttp .client .request (
77
+ method = "POST" ,
78
+ url = self .http_url_sanity ,
79
+ headers = self .request_headers (),
80
+ chunked = True ,
81
+ data = data_to_send ,
82
+ ) as resp :
83
+ self ._assert_basic_attributes_and_headers (resp )
84
+ spans = self .memory_exporter .get_finished_spans ()
85
+ span = spans [0 ]
86
+
87
+ self .assertEqual (
88
+ span .attributes [SemanticAttributes .HTTP_REQUEST_BODY ],
89
+ str (data_to_send ),
90
+ )
91
+ self .assertEqual (
92
+ span .attributes [SemanticAttributes .HTTP_RESPONSE_BODY ],
93
+ self .response_body (),
94
+ )
95
+ self .assertEqual (len (logs_written .records ), 1 )
94
96
95
97
async def test_get_request_error (self ):
96
98
Configuration ().payloads_enabled = True
0 commit comments