Skip to content

Commit 24ff380

Browse files
committed
apply rest_client_patch.diff
1 parent 565a315 commit 24ff380

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

kubernetes/client/rest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ def request(self, method, url, query_params=None, headers=None,
154154
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
155155
if query_params:
156156
url += '?' + urlencode(query_params)
157-
if re.search('json', headers['Content-Type'], re.IGNORECASE):
157+
if (re.search('json', headers['Content-Type'], re.IGNORECASE) or
158+
headers['Content-Type'] == 'application/apply-patch+yaml'):
159+
if headers['Content-Type'] == 'application/json-patch+json':
160+
if not isinstance(body, list):
161+
headers['Content-Type'] = \
162+
'application/strategic-merge-patch+json'
158163
request_body = None
159164
if body is not None:
160165
request_body = json.dumps(body)

0 commit comments

Comments
 (0)