Skip to content

Commit 7ed3af1

Browse files
authored
{Test} Update the response processing in EmailAddressReplacer (#31677)
1 parent 55f95f9 commit 7ed3af1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/azure-cli-testsdk/azure/cli/testsdk/utilities.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ def process_request(self, request):
229229

230230
def process_response(self, response):
231231
if response['body']['string']:
232-
body = _byte_to_str(response['body']['string'])
233-
response['body']['string'] = self._replace_email_address(body)
232+
try:
233+
body = _byte_to_str(response['body']['string'])
234+
response['body']['string'] = self._replace_email_address(body)
235+
except UnicodeDecodeError:
236+
# If the body is not a string, we cannot decode it, so we skip the replacement
237+
pass
234238
return response
235239

236240

0 commit comments

Comments
 (0)