| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5370979 commit 7beb20f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -694,7 +694,7 @@ def http_request( | |||
| 694 | 694 | stream=streamed, | |
| 695 | 695 | **opts, | |
| 696 | 696 | ) | |
| 697 | - except requests.ConnectionError: | ||
| 697 | + except (requests.ConnectionError, requests.exceptions.ChunkedEncodingError): | ||
| 698 | 698 | if retry_transient_errors and ( | |
| 699 | 699 | max_retries == -1 or cur_retries < max_retries | |
| 700 | 700 | ): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,16 @@ def request_callback(request): | |||
| 99 | 99 | ||
| 100 | 100 | ||
| 101 | 101 | @responses.activate | |
| 102 | - def test_http_request_with_retry_on_method_for_transient_network_failures(gl): | ||
| 102 | + @pytest.mark.parametrize( | ||
| 103 | + "exception", | ||
| 104 | + [ | ||
| 105 | + requests.ConnectionError("Connection aborted."), | ||
| 106 | + requests.exceptions.ChunkedEncodingError("Connection broken."), | ||
| 107 | + ], | ||
| 108 | + ) | ||
| 109 | + def test_http_request_with_retry_on_method_for_transient_network_failures( | ||
| 110 | + gl, exception | ||
| 111 | + ): | ||
| 103 | 112 | call_count = 0 | |
| 104 | 113 | calls_before_success = 3 | |
| 105 | 114 | ||
@@ -114,7 +123,7 @@ def request_callback(request): | |||
| 114 | 123 | ||
| 115 | 124 | if call_count >= calls_before_success: | |
| 116 | 125 | return (status_code, headers, body) | |
| 117 | - raise requests.ConnectionError("Connection aborted.") | ||
| 126 | + raise exception | ||
| 118 | 127 | ||
| 119 | 128 | responses.add_callback( | |
| 120 | 129 | method=responses.GET, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments