1
0
mirror of https://github.com/httpie/cli.git synced 2024-11-21 17:16:30 +02:00
httpie-cli/httpie/adapters.py
Batuhan Taskaya c000886546
Preserve individual headers with the same name on responses (#1208)
* Preserve individual headers with the same name on responses

* Rename RequestHeadersDict to HTTPHeadersDict

* Update tests/utils/http_server.py

* Update tests/utils/http_server.py

* Update httpie/adapters.py

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-11-24 15:41:37 -08:00

14 lines
448 B
Python

from httpie.cli.dicts import HTTPHeadersDict
from requests.adapters import HTTPAdapter
class HTTPieHTTPAdapter(HTTPAdapter):
def build_response(self, req, resp):
"""Wrap the original headers with the `HTTPHeadersDict`
to preserve multiple headers that have the same name"""
response = super().build_response(req, resp)
response.headers = HTTPHeadersDict(getattr(resp, 'headers', {}))
return response