-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathapi_client_strategic_merge_patch.diff
24 lines (21 loc) · 1.2 KB
/
api_client_strategic_merge_patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- /tmp/api_client.py 2024-12-18 03:36:59.552742383 +0000
+++ kubernetes_asyncio/client/api_client.py 2024-12-18 03:36:11.062928089 +0000
@@ -535,10 +535,17 @@
content_types = [x.lower() for x in content_types]
- if (method == 'PATCH' and
- 'application/json-patch+json' in content_types and
- isinstance(body, list)):
- return 'application/json-patch+json'
+ if method == 'PATCH':
+ if ('application/json-patch+json' in content_types and
+ isinstance(body, list)):
+ return 'application/json-patch+json'
+ if isinstance(body, dict) or hasattr(body, "to_dict"):
+ if 'application/strategic-merge-patch+json' in content_types:
+ return 'application/strategic-merge-patch+json'
+ elif 'application/merge-patch+json' in content_types:
+ # Intended for cases where strategic merge patch is not
+ # supported, like when patching custom objects.
+ return 'application/merge-patch+json'
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'