From e834154030c5c554443ea73770dfbf6c965a826c Mon Sep 17 00:00:00 2001 From: Ke Zhu Date: Sat, 15 Jul 2017 12:52:38 -0400 Subject: [PATCH] Fixes #3134 by correct response content-type of /testconn (#3135) --- superset/views/core.py | 2 +- tests/core_tests.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/superset/views/core.py b/superset/views/core.py index 8a5de069ef..dec49edd23 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1374,7 +1374,7 @@ class Superset(BaseSupersetView): .get('connect_args', {})) engine = create_engine(uri, connect_args=connect_args) engine.connect() - return json.dumps(engine.table_names(), indent=4) + return json_success(json.dumps(engine.table_names(), indent=4)) except Exception as e: logging.exception(e) return json_error_response(( diff --git a/tests/core_tests.py b/tests/core_tests.py index 7ff48a9081..f3e98873a6 100644 --- a/tests/core_tests.py +++ b/tests/core_tests.py @@ -284,6 +284,7 @@ class CoreTests(SupersetTestCase): }) response = self.client.post('/superset/testconn', data=data, content_type='application/json') assert response.status_code == 200 + assert response.headers['Content-Type'] == 'application/json' # validate that the endpoint works with the decrypted sqlalchemy uri data = json.dumps({ @@ -292,6 +293,7 @@ class CoreTests(SupersetTestCase): }) response = self.client.post('/superset/testconn', data=data, content_type='application/json') assert response.status_code == 200 + assert response.headers['Content-Type'] == 'application/json' def test_databaseview_edit(self, username='admin'): # validate that sending a password-masked uri does not over-write the decrypted uri