-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: cache etag support #3758
feat: cache etag support #3758
Conversation
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. |
d914909
to
9eeff6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@flakey5 this now conflicts |
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
9eeff6c
to
7ed13ec
Compare
Co-authored-by: Carlos Fuentes <me@metcoder.dev>
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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