Skip to content

fix: align PaymentBodyLayer retry and cache semantics - #313

Open
vikions wants to merge 1 commit into
tempoxyz:mainfrom
vikions:fix/payment-body-layer-parity
Open

fix: align PaymentBodyLayer retry and cache semantics#313
vikions wants to merge 1 commit into
tempoxyz:mainfrom
vikions:fix/payment-body-layer-parity

Conversation

@vikions

@vikions vikions commented Jul 12, 2026

Copy link
Copy Markdown

Summary

  • return a fresh body-bound WWW-Authenticate challenge with Cache-Control: no-store after failed payment verification
  • mark successful body-aware receipt responses as private while preserving existing cache directives
  • add regression tests for both retryable 402 responses and receipt cache behavior

Motivation

PaymentBodyService diverged from the standard PaymentService behavior in two protocol-relevant paths:

  • failed verification returned a bare 402 without a fresh payment challenge
  • successful responses containing Payment-Receipt did not receive private cache semantics

Body-digest binding should not change the retry lifecycle or receipt caching behavior of the Tower payment middleware.

Testing

  • cargo test --lib body_service --no-default-features --features tower
  • cargo fmt --check
  • cargo clippy --lib --no-default-features --features tower
  • git diff --check

All focused tests pass. Clippy reports only pre-existing cfg-dependent warnings unrelated to this change.

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.

1 participant