From 382dd3373f269727b45cce89300079088d80d8a0 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 9 Oct 2020 11:00:49 +0200 Subject: [PATCH 1/2] change response header html for json --- ereuse_devicehub/resources/versions/versions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ereuse_devicehub/resources/versions/versions.py b/ereuse_devicehub/resources/versions/versions.py index f2b8d393..52ec92f6 100644 --- a/ereuse_devicehub/resources/versions/versions.py +++ b/ereuse_devicehub/resources/versions/versions.py @@ -6,9 +6,11 @@ import teal.marshmallow from typing import Callable, Iterable, Tuple from urllib.parse import urlparse from flask import make_response, g +from flask.json import jsonify from teal.resource import Resource, View from ereuse_devicehub.resources.inventory.model import Inventory +from ereuse_devicehub.resources.versions.schemas import Versions from ereuse_devicehub import __version__ @@ -35,6 +37,10 @@ class VersionView(View): tag_version = get_tag_version(self.resource_def.app) versions = {'devicehub': __version__, "ereuse_tag": "0.0.0"} versions.update(tag_version) + + ret = jsonify(versions) + ret.status_code = 200 + # return ret return json.dumps(versions) From f257f192e6871d1765d1bb0580a95c0855da0496 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 9 Oct 2020 11:35:16 +0200 Subject: [PATCH 2/2] fixed bug --- ereuse_devicehub/resources/versions/versions.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/versions/versions.py b/ereuse_devicehub/resources/versions/versions.py index 52ec92f6..78af7f6a 100644 --- a/ereuse_devicehub/resources/versions/versions.py +++ b/ereuse_devicehub/resources/versions/versions.py @@ -10,7 +10,6 @@ from flask.json import jsonify from teal.resource import Resource, View from ereuse_devicehub.resources.inventory.model import Inventory -from ereuse_devicehub.resources.versions.schemas import Versions from ereuse_devicehub import __version__ @@ -40,8 +39,7 @@ class VersionView(View): ret = jsonify(versions) ret.status_code = 200 - # return ret - return json.dumps(versions) + return ret class VersionDef(Resource):