forked from loafle/openapi-generator-original
Make python code compatible with urllib3 v2.6.0+ (#22520)
openapi-generator still uses methods that have been removed from urllib3 v2.6.0. The solution is as described in urllib3's changelog: > Removed the HTTPResponse.getheaders() method in favor of > HTTPResponse.headers. Removed the HTTPResponse.getheader(name, > default) method in favor of HTTPResponse.headers.get(name, default). > (#3622) See https://urllib3.readthedocs.io/en/latest/changelog.html Close #22514
This commit is contained in:
@@ -49,12 +49,17 @@ class RESTResponse(io.IOBase):
|
||||
self.data = self.response.data
|
||||
return self.data
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
"""Returns a dictionary of response headers."""
|
||||
return self.response.headers
|
||||
|
||||
def getheaders(self):
|
||||
"""Returns a dictionary of the response headers."""
|
||||
"""Returns a dictionary of the response headers; use ``headers`` instead."""
|
||||
return self.response.headers
|
||||
|
||||
def getheader(self, name, default=None):
|
||||
"""Returns a given response header."""
|
||||
"""Returns a given response header; use ``headers.get()`` instead."""
|
||||
return self.response.headers.get(name, default)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user