Skip to content

Commit

Permalink
Handle header_params same as upstream (#410)
Browse files Browse the repository at this point in the history
Co-authored-by: Fabian von Feilitzsch <[email protected]>
  • Loading branch information
openshift-cherrypick-robot and fabianvf authored Jun 23, 2021
1 parent b652544 commit 5dd23b8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions openshift/dynamic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def watch(self, resource, namespace=None, name=None, label_selector=None, field_
yield event

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

Expand Down Expand Up @@ -216,12 +216,14 @@ def request(self, method, path, body=None, accept_header=None, **params):
header_params = params.get('header_params', {})
form_params = []
local_var_files = {}
# HTTP header `Accept`
header_params['Accept'] = accept_header or self.client.select_header_accept([
'application/json',
'application/yaml',
'application/vnd.kubernetes.protobuf'
])

# Checking Accept header.
new_header_params = dict((key.lower(), value) for key, value in header_params.items())
if not 'accept' in new_header_params:
header_params['Accept'] = self.client.select_header_accept([
'application/json',
'application/yaml',
])

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

0 comments on commit 5dd23b8

Please sign in to comment.