fix(api): cap retry-after at 5 minutes and improve test coverage#1870
Merged
fix(api): cap retry-after at 5 minutes and improve test coverage#1870
Conversation
- Add MAX_RETRY_AFTER_SECONDS (300s) cap to prevent excessively long waits from buggy or malicious servers - Fix _parseRetryAfter to properly reject negative and zero values - Add comprehensive edge case tests for retry-after parsing: - Numeric cap, HTTP-date cap, invalid strings, negative/zero values, whitespace - Add missing test coverage for chain utilities: - usesAlternateProtocol helper - getNativeWrapTokenAddress function - Monad chain in getChainId tests - Normalize rate limit log messages to always use seconds (was mixing ms/seconds) Co-Authored-By: Claude Opus 4.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MAX_RETRY_AFTER_SECONDS(300s) cap to prevent excessively long waits from buggy or malicious servers_parseRetryAfterto properly reject negative and zero values (was falling through to date parsing)Test Coverage Added
Retry-After parsing edge cases:
Chain utilities (previously untested):
usesAlternateProtocol()helpergetNativeWrapTokenAddress()functiongetChainIdtest listRelated
Follow-up improvements to #1858 (HTTP-date Retry-After support)
🤖 Generated with Claude Code