From 0625d765def4e76df3242e99b8e79b6397c23d8c Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Wed, 10 Sep 2025 13:05:29 +0300 Subject: [PATCH] feat: release version 3.5.7 with bug fix for step request data - Updated version to 3.5.7 in pyproject.toml. - Fixed an issue where step request data was not being set correctly, enhancing data handling for requests and responses. - Updated changelog to reflect the new version and bug fix. --- qase-python-commons/changelog.md | 6 ++++ qase-python-commons/pyproject.toml | 2 +- .../src/qase/commons/models/step.py | 28 ++++++++++++++++--- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/qase-python-commons/changelog.md b/qase-python-commons/changelog.md index d007564c..a454c762 100644 --- a/qase-python-commons/changelog.md +++ b/qase-python-commons/changelog.md @@ -1,3 +1,9 @@ +# qase-python-commons@3.5.7 + +## What's new + +- Fixed an issue where step request data was not being set correctly. + # qase-python-commons@3.5.6 ## What's new diff --git a/qase-python-commons/pyproject.toml b/qase-python-commons/pyproject.toml index 41cd6e7c..364a3977 100644 --- a/qase-python-commons/pyproject.toml +++ b/qase-python-commons/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-python-commons" -version = "3.5.6" +version = "3.5.7" description = "A library for Qase TestOps and Qase Report" readme = "README.md" authors = [{name = "Qase Team", email = "support@qase.io"}] diff --git a/qase-python-commons/src/qase/commons/models/step.py b/qase-python-commons/src/qase/commons/models/step.py index 07e59034..5f1a0eec 100644 --- a/qase-python-commons/src/qase/commons/models/step.py +++ b/qase-python-commons/src/qase/commons/models/step.py @@ -43,10 +43,20 @@ def __init__(self, request_body: str, request_headers: Dict[str, str], request_m self.response_body = None self.status_code = None if isinstance(request_body, bytes): - request_body = request_body.decode('utf-8') + try: + request_body = request_body.decode('utf-8') + except UnicodeDecodeError: + # For binary data (like file uploads), keep as base64 encoded string + import base64 + request_body = base64.b64encode(request_body).decode('ascii') self.request_body = request_body if isinstance(request_headers, bytes): - request_headers = request_headers.decode('utf-8') + try: + request_headers = request_headers.decode('utf-8') + except UnicodeDecodeError: + # For binary headers, keep as base64 encoded string + import base64 + request_headers = base64.b64encode(request_headers).decode('ascii') self.request_headers = request_headers self.request_method = request_method self.request_url = request_url @@ -56,10 +66,20 @@ def add_response(self, status_code: int, response_body: Optional[str] = None, self.status_code = status_code if isinstance(response_body, bytes): - response_body = response_body.decode('utf-8') + try: + response_body = response_body.decode('utf-8') + except UnicodeDecodeError: + # For binary data (like file downloads), keep as base64 encoded string + import base64 + response_body = base64.b64encode(response_body).decode('ascii') self.response_body = response_body if isinstance(response_headers, bytes): - response_headers = response_headers.decode('utf-8') + try: + response_headers = response_headers.decode('utf-8') + except UnicodeDecodeError: + # For binary headers, keep as base64 encoded string + import base64 + response_headers = base64.b64encode(response_headers).decode('ascii') self.response_headers = response_headers