File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -701,7 +701,7 @@ def http_request(
701701 stream = streamed ,
702702 ** opts ,
703703 )
704- except requests .ConnectionError :
704+ except ( requests .ConnectionError , requests . exceptions . ChunkedEncodingError ) :
705705 if retry_transient_errors and (
706706 max_retries == - 1 or cur_retries < max_retries
707707 ):
Original file line number Diff line number Diff line change @@ -102,7 +102,16 @@ def request_callback(request):
102102
103103
104104@responses .activate
105- def test_http_request_with_retry_on_method_for_transient_network_failures (gl ):
105+ @pytest .mark .parametrize (
106+ "exception" ,
107+ [
108+ requests .ConnectionError ("Connection aborted." ),
109+ requests .exceptions .ChunkedEncodingError ("Connection broken." ),
110+ ],
111+ )
112+ def test_http_request_with_retry_on_method_for_transient_network_failures (
113+ gl , exception
114+ ):
106115 call_count = 0
107116 calls_before_success = 3
108117
@@ -117,7 +126,7 @@ def request_callback(request):
117126
118127 if call_count >= calls_before_success :
119128 return (status_code , headers , body )
120- raise requests . ConnectionError ( "Connection aborted." )
129+ raise exception
121130
122131 responses .add_callback (
123132 method = responses .GET ,
You can’t perform that action at this time.
0 commit comments