diff --git a/cloudshell/rest/api.py b/cloudshell/rest/api.py index 50acd58..5b19195 100644 --- a/cloudshell/rest/api.py +++ b/cloudshell/rest/api.py @@ -132,8 +132,9 @@ def export_package(self, topologies): url = "http://{0.ip}:{0.port}/API/Package/ExportPackage".format(self) response = post( url, - headers={"Authorization": "Basic " + self.token}, - data={"TopologyNames": topologies}, + headers={"Authorization": "Basic " + self.token, + "Content-type": "application/json"}, + json={"TopologyNames": topologies}, ) if response.status_code in (404, 405): diff --git a/tests/test_packaging_rest_api_client.py b/tests/test_packaging_rest_api_client.py index 1a3a692..faedda5 100644 --- a/tests/test_packaging_rest_api_client.py +++ b/tests/test_packaging_rest_api_client.py @@ -309,8 +309,9 @@ def test_export_package(self, mock_post, mock_build_opener): # verify mock_post.assert_called_once_with( 'http://SERVER:9000/API/Package/ExportPackage', - headers={'Authorization': 'Basic TOKEN'}, - data={'TopologyNames': ['topology_name']}, + headers={'Authorization': 'Basic TOKEN', + 'Content-type': 'application/json'}, + json={'TopologyNames': ['topology_name']}, ) self.assertEqual(response, 'zip package content')