From 9715efa2012abe6cc098c6ca2295e750a03c69e2 Mon Sep 17 00:00:00 2001 From: Colas Chen Date: Mon, 28 Jul 2025 15:20:32 +0800 Subject: [PATCH] fix(utils): decode response body in exception for readability Ensure response body is decoded to UTF-8 when raising ResponseException, --- alipay/aop/api/util/WebUtils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alipay/aop/api/util/WebUtils.py b/alipay/aop/api/util/WebUtils.py index 0d4802d12..e8da61a5b 100644 --- a/alipay/aop/api/util/WebUtils.py +++ b/alipay/aop/api/util/WebUtils.py @@ -147,7 +147,7 @@ def do_post(url, query_string=None, headers=None, params=None, charset='utf-8', response = connection.getresponse() if response.status != 200: raise ResponseException('[' + THREAD_LOCAL.uuid + ']invalid http status ' + str(response.status) + \ - ',detail body:' + response.read()) + ',detail body:' + response.read().decode(encoding='utf-8')) result = response.read() try: response.close()