codekingpro/portable-devtools
114k
1from httpie.cli.dicts import HTTPHeadersDict2from requests.adapters import HTTPAdapter3 4 5class HTTPieHTTPAdapter(HTTPAdapter):6 7 def build_response(self, req, resp):8 """Wrap the original headers with the `HTTPHeadersDict`9 to preserve multiple headers that have the same name"""10 11 response = super().build_response(req, resp)12 response.headers = HTTPHeadersDict(getattr(resp, 'headers', {}))13 return response14 