Skip to content

fix: expose lowercase retry-after on synchronous 429 responses - #327

Open
pcbeingused33 wants to merge 1 commit into
resend:mainfrom
pcbeingused33:fix/c8876-retry-after
Open

pcbeingused33 wants to merge 1 commit into
resend:mainfrom
pcbeingused33:fix/c8876-retry-after

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Dec 3, 2026 •

Copy link
Copy Markdown

The synchronous client copies the case-insensitive Requests response headers into a plain dictionary. If a 429 response contains Retry-After: 5, looking up the documented lowercase header on RateLimitError.headers returns None.

For synchronous HTTP 429 responses, add a lowercase retry-after entry when the header is present. Retain the original header keys and any existing lowercase entry so callers can keep using their current lookups.

The regression test mocks a Requests response with Retry-After: 5 and checks that both spellings return "5". Run it with python -m pytest -q tests/request_test.py.

This change and its regression test were prepared with AI assistance.


Summary by cubic

Fixes RateLimitError.headers on synchronous 429 responses so the documented lowercase retry-after lookup returns the retry value instead of None when the response uses Retry-After.

  • Copies a lowercase retry-after entry for 429 responses while keeping original header keys intact.
  • Regression test now uses a case-insensitive header map and asserts both Retry-After and retry-after resolve to "5".

Written for commit acd904c. Summary will update on new commits.

View guided diff

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant