feat(http): also retry on transient status code 520#337
Merged
Conversation
Add Cloudflare status code 520 ("Web Server Returned an Unknown Error")
to the HTTP client's retryable status codes, alongside the existing
503/521/522/524/530.
Brings this SDK in line with the go-sdk and python-sdk. Relates to
descope/etc#14039
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🐕 Review complete — View session on Shuni Portal 🐾 |
🐕 Suggested ReviewersThe review assignment prioritizes recent contributors active in the changed files, diversifying the reviewers to cover different parts of the implementation. This approach leverages recent modifications and subjects the changes to knowledgeable eyes.
Suggested by Shuni based on git history and PR context. Names are not @-mentioned to avoid notifying anyone — request a review from whoever fits best. |
There was a problem hiding this comment.
🐕 Shuni's Review
Adds Cloudflare status 520 to the HTTP client's retryable codes, with matching comment and test updates.
No issues found — good bones! Clean, consistent with the existing 52x codes; tests cover membership, the size count (5→6), and the retry loop. Woof!
aviadl
approved these changes
Jun 22, 2026
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
Add Cloudflare status code
520("Web Server Returned an Unknown Error") to the HTTP client's retryable status codes, alongside the existing503/521/522/524/530.Like the other Cloudflare 52x codes already retried,
520is a transient edge error returned when the origin is briefly unreachable (e.g. during pod replacement on deploy), so the request is safe to retry. Follow-up to #302; brings this SDK in line with go-sdk (descope/go-sdk#775), python-sdk (descope/python-sdk#1581) and core-js-sdk (descope/descope-js#1423).https://github.com/descope/etc/issues/14039
Test plan
520to the retryable-status-codes test/data set, mirroring the existing per-code coverage🤖 Generated with Claude Code