Skip to content

Commit

Permalink
Merge pull request #94 from andrzej-zamojski/http-request-headers-fix
Browse files Browse the repository at this point in the history
Make HTTP headers Accept and OData-Version configurable for user
  • Loading branch information
mraineri authored Aug 7, 2020
2 parents b5f94e9 + 2d1eb20 commit ad100fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/redfish/rest/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,10 @@ def _get_req_headers(self, headers=None):
elif self.__authorization_key:
headers['Authorization'] = self.__authorization_key

headers['Accept'] = '*/*'
headers_keys = set(k.lower() for k in headers)
if 'accept' not in headers_keys:
headers['Accept'] = '*/*'

headers['Connection'] = 'Keep-Alive'

return headers
Expand Down Expand Up @@ -1069,7 +1072,9 @@ def _get_req_headers(self, headers=None, providerheader=None):
"""
headers = super(HttpClient, self)._get_req_headers(headers)
headers['OData-Version'] = '4.0'
headers_keys = set(k.lower() for k in headers)
if 'odata-version' not in headers_keys:
headers['OData-Version'] = '4.0'

return headers

Expand Down

0 comments on commit ad100fb

Please sign in to comment.