From b7e3b422fddd89451b65bd7be8518a34a9abe56c Mon Sep 17 00:00:00 2001 From: Sergei Shishov Date: Mon, 21 Jul 2025 16:13:06 +0300 Subject: [PATCH] chore(retry-after): add support for Retry-After header Fixes: https://github.com/getsentry/responses/issues/768 Signed-off-by: Sergei Shishov --- responses/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/responses/__init__.py b/responses/__init__.py index 3717f8a3..30d45fdb 100644 --- a/responses/__init__.py +++ b/responses/__init__.py @@ -1152,7 +1152,9 @@ def _on_request( # first validate that current request is eligible to be retried. # See ``urllib3.util.retry.Retry`` documentation. if retries.is_retry( - method=response.request.method, status_code=response.status_code # type: ignore[misc] + method=response.request.method, # type: ignore[misc] + status_code=response.status_code, # type: ignore[misc] + has_retry_after="Retry-After" in response.headers, # type: ignore[misc] ): try: retries = retries.increment(