Skip to content

Conversation

@k1LoW
Copy link
Member

@k1LoW k1LoW commented Nov 13, 2025

According to RFC 9111 Section 5.2.2.3, when a cache that implements the
must-understand directive receives a response that includes it, the cache
SHOULD ignore the no-store directive if it understands and implements the
status code's caching requirements.

This change modifies the Storable() method to ignore no-store when:

  • must-understand directive is present
  • AND the cache understands the response status code

Added test cases to verify the behavior:

  • Status 200 with must-understand + no-store -> cacheable
  • Status 418 with must-understand + no-store -> cacheable
  • Status 299 (unknown) with must-understand + no-store -> not cacheable

…RFC 9111 Section 5.2.2.3

  According to RFC 9111 Section 5.2.2.3, when a cache that implements the
  must-understand directive receives a response that includes it, the cache
  SHOULD ignore the no-store directive if it understands and implements the
  status code's caching requirements.

  This change modifies the Storable() method to ignore no-store when:
  - must-understand directive is present
  - AND the cache understands the response status code

  Added test cases to verify the behavior:
  - Status 200 with must-understand + no-store -> cacheable
  - Status 418 with must-understand + no-store -> cacheable
  - Status 299 (unknown) with must-understand + no-store -> not cacheable
@k1LoW k1LoW self-assigned this Nov 13, 2025
@k1LoW k1LoW added bug Something isn't working rfc9111 labels Nov 13, 2025
@github-actions
Copy link
Contributor

Code Metrics Report

main (cf0ad24) #98 (a91230c) +/-
Coverage 61.7% 62.0% +0.2%
Code to Test Ratio 1:2.3 1:2.4 +0.0
Test Execution Time 1m0s 1m2s +2s
Details
  |                     | main (cf0ad24) | #98 (a91230c) |  +/-  |
  |---------------------|----------------|---------------|-------|
+ | Coverage            |          61.7% |         62.0% | +0.2% |
  |   Files             |              8 |             8 |     0 |
  |   Lines             |            513 |           514 |    +1 |
+ |   Covered           |            317 |           319 |    +2 |
+ | Code to Test Ratio  |          1:2.3 |         1:2.4 |  +0.0 |
  |   Code              |            853 |           854 |    +1 |
+ |   Test              |           2029 |          2077 |   +48 |
- | Test Execution Time |           1m0s |          1m2s |   +2s |

Code coverage of files in pull request scope (78.5% → 79.0%)

Files Coverage +/- Status
rfc9111/directive.go 67.1% +1.4% affected
rfc9111/shared.go 83.3% +0.0% modified

Reported by octocov

@k1LoW k1LoW marked this pull request as ready for review November 13, 2025 14:19
@k1LoW k1LoW merged commit 4390ee0 into main Nov 13, 2025
1 check passed
@k1LoW k1LoW deleted the must-understand branch November 13, 2025 14:19
@github-actions github-actions bot mentioned this pull request Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rfc9111

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants