File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -701,7 +701,7 @@ def http_request(
701
701
stream = streamed ,
702
702
** opts ,
703
703
)
704
- except requests .ConnectionError :
704
+ except ( requests .ConnectionError , requests . exceptions . ChunkedEncodingError ) :
705
705
if retry_transient_errors and (
706
706
max_retries == - 1 or cur_retries < max_retries
707
707
):
Original file line number Diff line number Diff line change @@ -102,7 +102,16 @@ def request_callback(request):
102
102
103
103
104
104
@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
+ ):
106
115
call_count = 0
107
116
calls_before_success = 3
108
117
@@ -117,7 +126,7 @@ def request_callback(request):
117
126
118
127
if call_count >= calls_before_success :
119
128
return (status_code , headers , body )
120
- raise requests . ConnectionError ( "Connection aborted." )
129
+ raise exception
121
130
122
131
responses .add_callback (
123
132
method = responses .GET ,
You can’t perform that action at this time.
0 commit comments