Skip to content

Commit 5dd23b8

Browse files
Handle header_params same as upstream (#410)
Co-authored-by: Fabian von Feilitzsch <[email protected]>
1 parent b652544 commit 5dd23b8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

openshift/dynamic/client.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def watch(self, resource, namespace=None, name=None, label_selector=None, field_
186186
yield event
187187

188188
@meta_request
189-
def request(self, method, path, body=None, accept_header=None, **params):
189+
def request(self, method, path, body=None, **params):
190190
if not path.startswith('/'):
191191
path = '/' + path
192192

@@ -216,12 +216,14 @@ def request(self, method, path, body=None, accept_header=None, **params):
216216
header_params = params.get('header_params', {})
217217
form_params = []
218218
local_var_files = {}
219-
# HTTP header `Accept`
220-
header_params['Accept'] = accept_header or self.client.select_header_accept([
221-
'application/json',
222-
'application/yaml',
223-
'application/vnd.kubernetes.protobuf'
224-
])
219+
220+
# Checking Accept header.
221+
new_header_params = dict((key.lower(), value) for key, value in header_params.items())
222+
if not 'accept' in new_header_params:
223+
header_params['Accept'] = self.client.select_header_accept([
224+
'application/json',
225+
'application/yaml',
226+
])
225227

226228
# HTTP header `Content-Type`
227229
if params.get('content_type'):

0 commit comments

Comments
 (0)