From c244b5a2c2070363ea814c4b29e3c1817fe412da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org>
Date: Mon, 4 Apr 2022 15:41:42 +0200
Subject: [PATCH] FIX: type of body for MockupResponse

---
 CHANGELOG.md                    | 1 +
 src/caosdb/connection/mockup.py | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75317f22..e45657c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 * [#75](https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/75), [#103](https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/103) Fixed JSON schema to allow more sections, and correct requirements for
   password method.
+- `read()` of MockupResponse returns now an appropriate type on modern systems
 
 ### Security ###
 
diff --git a/src/caosdb/connection/mockup.py b/src/caosdb/connection/mockup.py
index 692ec2b1..aaa9e09b 100644
--- a/src/caosdb/connection/mockup.py
+++ b/src/caosdb/connection/mockup.py
@@ -26,6 +26,7 @@ up a tcp connection."""
 
 from __future__ import unicode_literals, print_function
 from io import StringIO
+from sys import hexversion
 from .connection import CaosDBServerConnection, CaosDBHTTPResponse
 
 
@@ -56,7 +57,10 @@ class MockUpResponse(CaosDBHTTPResponse):
 
     def read(self, size=-1):
         """Return the body of the response."""
-        return self.response.read(size)
+        if hexversion < 0x03000000:
+            return self.response.read(size)
+        else:
+            return self.response.read(size).encode()
 
     def getheader(self, name, default=None):
         """Get the contents of the header `name`, or `default` if there is no
-- 
GitLab