From bd33e310e09339a21097c66d4022538f6bcbad2f Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Thu, 14 Mar 2019 20:27:25 +0530 Subject: Set Content-Type header explictly for SessionClient SessionClient is subclassed from keystoneauth LegacyJsonAdapter. LegacyJsonAdapter does not set the Content-Type explicitly and results in decodeing issues in some cases. Change-Id: Idf23022b394607c332490331fc4b216de6ff1313 Story: 2005237 Task: 30027 --- heatclient/common/http.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'heatclient/common') diff --git a/heatclient/common/http.py b/heatclient/common/http.py index 0894e19..1f86c24 100644 --- a/heatclient/common/http.py +++ b/heatclient/common/http.py @@ -308,6 +308,9 @@ class SessionClient(adapter.LegacyJsonAdapter): redirect = kwargs.get('redirect') kwargs.setdefault('user_agent', USER_AGENT) + headers = kwargs.setdefault('headers', {}) + headers.setdefault('Content-Type', 'application/json') + if 'data' in kwargs: kwargs['data'] = jsonutils.dumps(kwargs['data']) -- cgit v1.2.1