Skip to content

Consider "Retry-After" header in Java HTTP Client - #2044

Merged
kwin merged 2 commits into
masterfrom
feature/consider-retry-after-header
Aug 8, 2026
Merged

Consider "Retry-After" header in Java HTTP Client#2044
kwin merged 2 commits into
masterfrom
feature/consider-retry-after-header

Conversation

@kwin

@kwin kwin commented Aug 8, 2026

Copy link
Copy Markdown
Member

Add test

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@kwin
kwin force-pushed the feature/consider-retry-after-header branch from 01930c3 to 2acec97 Compare August 8, 2026 09:31
@kwin

kwin commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

Waiting for upstream build fix @gnodet.

@kwin
kwin requested a review from cstamas August 8, 2026 09:32
@kwin
kwin force-pushed the feature/consider-retry-after-header branch from 2acec97 to 5d42a80 Compare August 8, 2026 14:36
@kwin
kwin marked this pull request as ready for review August 8, 2026 14:37
@kwin
kwin requested a review from gnodet August 8, 2026 14:38

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-scoped change that adds Retry-After header support to the JDK HTTP transport by wrapping the existing linear backoff with methanol's retryAfterOr(). The test is well-designed, and all inheriting test classes are properly handled.

Two minor style notes (non-blocking):

  1. Method name casing: tooManyRequestswith runs words together — consider tooManyRequests_withRetryAfterHeader for consistency with the file's underscore convention.

  2. Field initialization: serverErrorHeaders defaults to null — initializing to Collections.emptyMap() would be more defensive and consistent with the 2-arg delegating overload.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

"Expected back off delay of at least " + retryIntervalMs);
}

@Test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: inconsistent casing — tooManyRequestswith runs the words together. Consider:

Suggested change
@Test
protected void testRetryHandler_tooManyRequests_withRetryAfterHeader_explicitCount_positive() throws Exception {

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both suggestions addressed — looks good. 👍

Claude Code on behalf of gnodet

@kwin
kwin merged commit bd2f8c6 into master Aug 8, 2026
22 of 23 checks passed
@kwin
kwin deleted the feature/consider-retry-after-header branch August 8, 2026 15:01
@github-actions github-actions Bot added this to the 2.0.22 milestone Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

@kwin Please assign appropriate label to PR according to the type of change.

@kwin kwin added the enhancement New feature or request label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants