Skip to content

Commit fd57dc4

Browse files
committed
Merge remote-tracking branch 'oauth2cli/dev' into http-interface-polish
2 parents e8ff807 + a07c3ef commit fd57dc4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

msal/oauth2cli/http.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class Response(object):
5858
# but a `text` would be more generic,
5959
# when downstream packages would potentially access some XML endpoints.
6060

61+
headers = {} # Duplicated headers are expected to be combined into one header
62+
# with its value as a comma-separated string.
63+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2
64+
# Popular HTTP libraries model it as a case-insensitive dict.
65+
6166
def raise_for_status(self):
6267
"""Raise an exception when http response status contains error"""
6368
raise NotImplementedError("Your implementation should provide this")

tests/http_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ def close(self): # Not required, but we use it to avoid a warning in unit test
2525

2626

2727
class MinimalResponse(object): # Not for production use
28-
def __init__(self, requests_resp=None, status_code=None, text=None):
28+
def __init__(self, requests_resp=None, status_code=None, text=None, headers=None):
2929
self.status_code = status_code or requests_resp.status_code
30-
self.text = text or requests_resp.text
30+
self.text = text if text is not None else requests_resp.text
31+
self.headers = {} if headers is None else headers
3132
self._raw_resp = requests_resp
3233

3334
def raise_for_status(self):

0 commit comments

Comments
 (0)