forked from kubernetes-client/python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrest_client_patch.diff
18 lines (18 loc) · 1.01 KB
/
rest_client_patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py
index 5716565df..b788bf7d2 100644
--- a/kubernetes/client/rest.py
+++ b/kubernetes/client/rest.py
@@ -151,7 +151,12 @@ class RESTClientObject(object):
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
if query_params:
url += '?' + urlencode(query_params)
- if re.search('json', headers['Content-Type'], re.IGNORECASE):
+ if (re.search('json', headers['Content-Type'], re.IGNORECASE) or
+ headers['Content-Type'] == 'application/apply-patch+yaml'):
+ if headers['Content-Type'] == 'application/json-patch+json':
+ if not isinstance(body, list):
+ headers['Content-Type'] = \
+ 'application/strategic-merge-patch+json'
request_body = None
if body is not None:
request_body = json.dumps(body)