Skip to content

Conversation

@JustinBeckwith
Copy link
Owner

Summary

Adds support for non-standard retry-after header formats used by CivicPlus and other services that use "30s" or "1m30s" notation instead of the standard seconds or HTTP date format.

This addresses the issue raised in #556 where services like CivicPlus return retry-after headers in formats like:

  • 3s (3 seconds)
  • 1m30s (1 minute 30 seconds)

Changes

  • ✅ Extract retry-after parsing logic into parseRetryAfter() method
  • ✅ Add regex support for "Xs" and "XmYs" time formats using pattern /^(?:(\d+)m)?(\d+)s$/
  • ✅ Add comprehensive tests for non-standard formats (3s, 1m1s)
  • ✅ Fix missing redirect parameter in 405 and fallback GET requests

Test Results

All 135 tests pass, including 2 new tests for non-standard retry-after formats:

  • should retry 429s with non-standard seconds format (3s)
  • should retry 429s with non-standard minutes and seconds format (1m1s)

Backward Compatibility

This change maintains full backward compatibility with existing retry-after header formats:

  • Plain seconds: 30
  • HTTP date: Wed, 21 Oct 2015 07:28:00 GMT

Credits

Based on the original implementation proposed by @mrienstra in #556. Updated to work with the current codebase (native fetch, redirect handling, etc).

Closes #556

🤖 Generated with Claude Code

Add support for non-standard retry-after header formats used by
CivicPlus and other services that use "30s" or "1m30s" notation
instead of the standard seconds or HTTP date format.

Changes:
- Extract retry-after parsing logic into parseRetryAfter() method
- Add regex support for "Xs" and "XmYs" time formats
- Add tests for non-standard formats (3s, 1m1s)
- Fix missing redirect parameter in 405 and fallback GET requests

Closes #556

Co-authored-by: Michael Rienstra <[email protected]>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@JustinBeckwith JustinBeckwith merged commit 8f9ca39 into main Oct 20, 2025
8 checks passed
@JustinBeckwith JustinBeckwith deleted the feat/non-standard-retry-after branch October 20, 2025 20:28
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.

2 participants