Skip to content

Conversation

flakey5
Copy link
Member

@flakey5 flakey5 commented Oct 21, 2024

Re http caching, adds support for etags for when we need to revalidate a cached response.

No breaking changes to the public api. the etag property is nullable so a cache store could just not implement it and it will be fine. However, I did add it to the tests as if it was required just so we can ensure the builtin cache stores fully support the behavior.

This only checks if the etag exists in the response's headers and ignores it if it's in the trailers for simplicity sakes (as allowed by the spec in 8.8.3)

Closes #3718

@mcollina
Copy link
Member

I think this is a bit too light on tests, and I'm not sure if this implementation is correct.

Can you add some tests where the response is a 304 thanks to if-none-match?

@SukkaW
Copy link
Contributor

SukkaW commented Oct 24, 2024

I think this is a bit too light on tests, and I'm not sure if this implementation is correct.

Can you add some tests where the response is a 304 thanks to if-none-match?

Also, we could test how undici responds to different server implementations. I myself have run into situations when locally stored strong ETag matches the server-sent one yet the server is returning the same ETag with 200 instead of 304.

@flakey5 flakey5 force-pushed the flakey5/3718 branch 2 times, most recently from d914909 to 9eeff6c Compare November 17, 2024 19:01
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina
Copy link
Member

@flakey5 this now conflicts

flakey5 and others added 4 commits November 18, 2024 11:34
Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit a73fd09 into nodejs:main Nov 18, 2024
36 checks passed
@github-actions github-actions bot mentioned this pull request Dec 3, 2024
This was referenced Dec 16, 2024
@github-actions github-actions bot mentioned this pull request Mar 12, 2025
@github-actions github-actions bot mentioned this pull request May 12, 2025
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.

Easier way to attach ETag to If-None-Match after #3562
6 participants