2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Add mandated client headers

Since we added gzip support due to a non-compliant
implementation firing gzip at us anyway, advertise
so that we have the benefit for compliant implementations.

Also add the OData-Version header.  This is required but
mostly not needed, except one implementation that uses it
to enter standard compliant mode and is non-compliant
without that in the client.

Change-Id: Ie2fdb95fa12f2ddef46506ca531e5188b6019227
This commit is contained in:
Jarrod Johnson 2019-05-16 09:21:19 -04:00
parent 5a15c6b604
commit 33db8cdfeb

View File

@ -271,6 +271,8 @@ class Command(object):
self._gpool = pool
self.wc.set_header('Accept', 'application/json')
self.wc.set_header('User-Agent', 'pyghmi')
self.wc.set_header('Accept-Encoding', 'gzip')
self.wc.set_header('OData-Version', '4.0')
overview = self.wc.grab_json_response('/redfish/v1/')
self.wc.set_basic_credentials(userid, password)
self.wc.set_header('Content-Type', 'application/json')