Skip to content

test: document and pin that a body-less non-idempotent request is not retried#87

Merged
OmarAlJarrah merged 2 commits into
mainfrom
test/bodyless-nonidempotent-retry
Jun 16, 2026
Merged

test: document and pin that a body-less non-idempotent request is not retried#87
OmarAlJarrah merged 2 commits into
mainfrom
test/bodyless-nonidempotent-retry

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

The retry-eligibility gate decides whether a body-less request may be retried based on method idempotency: a request with no body is retried only if its method is idempotent (GET/HEAD/OPTIONS/PUT/DELETE); a request with a body is retried only if that body is replayable. A consequence is that a bare POST (body-less, non-idempotent) is not retried — even though there is no body to re-send — because retrying a non-idempotent call is unsafe regardless of the body.

This is intended behavior, but it was neither documented nor pinned by a test.

Change

  • Documents the rule in the RetryStep and DefaultRetryStep KDoc and in docs/pipelines.md, spelling out the body-less/idempotency interaction and the bare-POST case.
  • Adds regression tests: a body-less POST against a retryable status (503) results in exactly one attempt (no retry), with a body-less PUT control demonstrating that the same body-less branch still retries an idempotent method.

KDoc, docs, and tests only — no behavior change, no public API change.

Closes #17

… retried

The retry-safety gate keys body-less requests off method idempotency rather
than off the absence of a body: with no body the request is retried only when
its method is idempotent, and with a body only when the body is replayable. A
consequence that was easy to miss is that a bare POST (a body-less,
non-idempotent request, e.g. a trigger/activate-style endpoint) is NOT retried
even though it carries no payload to re-send — replaying it could duplicate a
side effect the server may already have applied.

This behavior was intended but undocumented and untested. Make it explicit:

- Spell out the body-less branch in the KDoc of DefaultRetryStep (isRetrySafe
  and the "Body replayability" section) and the recovery-aware RetryStep
  (canRetry), stating that body-less retry safety keys off method idempotency.
- Tighten the retry idempotency note in docs/pipelines.md to match the actual
  per-axis gate and call out the bare-POST case.
- Add regression tests: a body-less POST against a retryable 503 results in
  exactly one attempt (no retry), with a body-less PUT control proving the
  same branch retries an idempotent method.

KDoc, docs, and tests only; no public API or behavior change.
…ne RetryStep suite

The http.pipeline DefaultRetryStep suite pins that a body-less request's
retry eligibility keys off method idempotency (bare POST not retried,
body-less PUT retried). The recovery-oriented pipeline.step.retry.RetryStep
gate has the same rule but only covered body-bearing requests
(non-replayable POST/PUT). Add the two body-less cases there so both gates
carry the regression, and cross-reference the mirrored cases in both suites.
@OmarAlJarrah OmarAlJarrah merged commit daff797 into main Jun 16, 2026
1 check passed
@OmarAlJarrah OmarAlJarrah deleted the test/bodyless-nonidempotent-retry branch June 16, 2026 18:27
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.

Body-less non-idempotent requests (e.g. bare POST) are no longer retried — document and test

1 participant