@@ -50,18 +50,6 @@ def close(self):
50
50
raise CloseMethodCalled ("Not used by MSAL, but our customers may use it" )
51
51
52
52
53
- class DummyHttpClientWithoutResponseHeaders (DummyHttpClient ):
54
- def post (self , url , params = None , data = None , headers = None , ** kwargs ):
55
- response = super ().post (url , params , data , headers , ** kwargs )
56
- del response .headers # Early versions of MSAL did not require http client to return headers
57
- return response
58
-
59
- def get (self , url , params = None , headers = None , ** kwargs ):
60
- response = super ().get (url , params , headers , ** kwargs )
61
- del response .headers # Early versions of MSAL did not require http client to return headers
62
- return response
63
-
64
-
65
53
class CloseMethodCalled (Exception ):
66
54
pass
67
55
@@ -99,9 +87,14 @@ def assertValidResponse(self, response):
99
87
self .assertCleanPickle (response )
100
88
101
89
def test_throttled_http_client_base_response_should_tolerate_headerless_response (self ):
102
- http_client = ThrottledHttpClientBase (DummyHttpClientWithoutResponseHeaders (
103
- status_code = 200 , response_text = "foo" ))
104
- response = http_client .post ("https://example.com" )
90
+ # MSAL Python 1.32.1 had a regression that caused it to require headers in the response.
91
+ # This was fixed in 1.32.2
92
+ # https://github.com/AzureAD/microsoft-authentication-library-for-python/compare/1.32.1...1.32.2
93
+ # This test case is to ensure that we can tolerate headerless response.
94
+ http_client = DummyHttpClient (status_code = 200 , response_text = "foo" )
95
+ raw_response = http_client .post ("https://example.com" )
96
+ self .assertFalse (hasattr (raw_response , "headers" ), "Should not contain headers" )
97
+ response = ThrottledHttpClientBase (http_client ).post ("https://example.com" )
105
98
self .assertEqual (response .text , "foo" , "Should return the same response text" )
106
99
107
100
def test_throttled_http_client_base_response_should_not_contain_signature (self ):
0 commit comments