Skip to content

Commit a602e3f

Browse files
committed
Fix: correect header retrieval for urllib3 compatibility
- add support for headers
1 parent a49d85d commit a602e3f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kubernetes/client/rest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ def __init__(self, resp):
4141

4242
def getheaders(self):
4343
"""Returns a dictionary of the response headers."""
44+
if hasattr(self.urllib3_response, 'headers'):
45+
return self.urllib3_response.headers.items()
4446
return self.urllib3_response.getheaders()
4547

4648
def getheader(self, name, default=None):
4749
"""Returns a given response header."""
50+
if hasattr(self.urllib3_response, 'headers'):
51+
return self.urllib3_response.headers.get(name, default)
4852
return self.urllib3_response.getheader(name, default)
4953

5054

0 commit comments

Comments
 (0)