Skip to content

[API] Use weak comparison for If-None-Match validation#325

Open
RedZapdos123 wants to merge 2 commits into
rage-rb:mainfrom
RedZapdos123:fix/if-none-match-weak-comparison
Open

[API] Use weak comparison for If-None-Match validation#325
RedZapdos123 wants to merge 2 commits into
rage-rb:mainfrom
RedZapdos123:fix/if-none-match-weak-comparison

Conversation

@RedZapdos123

@RedZapdos123 RedZapdos123 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description:

Issue #324 reported that If-None-Match validation used exact string comparison, so a strong request ETag like "..." did not match Rage's weak response ETag W/"...".

This PR updates Rage::Request#etag_matches? to use weak comparison for If-None-Match validation, while keeping wildcard handling unchanged.

It also updates the conditional GET regression spec to cover the strong-request / weak-response match and adds a changelog entry.

Closes #324.

Checklist:

  • I have added relevant regression test cases for this fix.
  • I have run linting checks in WSL using bundle exec rubocop --except Layout/EndOfLine lib/rage/request.rb spec/controller/api/conditional_get_spec.rb.
  • I have run focused tests in WSL using bundle exec rspec spec/controller/api/conditional_get_spec.rb.
  • I have run a broader controller API regression pass in WSL using bundle exec rspec spec/controller/api.

Before the fix:

image

After the fix:

image

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>

@rsamoilov rsamoilov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @RedZapdos123

This looks great! Left just one minor suggestion.

Comment thread lib/rage/request.rb Outdated
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
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.

[API] Use weak comparison for If-None-Match validation

3 participants