fix: expose lowercase retry-after on synchronous 429 responses

PC
19h ago
+13-8

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".