Conversation
|
Would it maybe be better to use jsdoc types rather than separate type definition files? @mcollina |
I think using type definitions are in line with the rest of the codebase, and therefore the correct implementation. If we want to migrate to a jsdoc-generated world, let's discuss in another issue! |
e07e3ec to
938fa7a
Compare
Implements bare-bones http caching as per rfc9111 Closes nodejs#3231 Closes nodejs#2760 Closes nodejs#2256 Closes nodejs#1146 Co-authored-by: Carlos Fuentes <[email protected]> Co-authored-by: Robert Nagy <[email protected]> Co-authored-by: Isak Törnros <[email protected]> Signed-off-by: flakey5 <[email protected]>
938fa7a to
f69a8b2
Compare
Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Co-authored-by: Robert Nagy <[email protected]>
Co-authored-by: Carlos Fuentes <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Uzlopak
left a comment
There was a problem hiding this comment.
headers could be null or undefined
Co-authored-by: Aras Abbasi <[email protected]>
Co-authored-by: Aras Abbasi <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Co-authored-by: Aras Abbasi <[email protected]>
Co-authored-by: Aras Abbasi <[email protected]>
Signed-off-by: flakey5 <[email protected]>
|
I will review it shortly ;) |
| // https://www.rfc-editor.org/rfc/rfc9111.html#name-age | ||
| const age = Math.round((Date.now() - value.cachedAt) / 1000) | ||
|
|
||
| value.rawHeaders.push(AGE_HEADER, Buffer.from(`${age}`)) |
There was a problem hiding this comment.
| value.rawHeaders.push(AGE_HEADER, Buffer.from(`${age}`)) | |
| value.rawHeaders.push(AGE_HEADER, Buffer.from(age)) |
| const CacheRevalidationHandler = require('../handler/cache-revalidation-handler') | ||
| const { UNSAFE_METHODS } = require('../util/cache.js') | ||
|
|
||
| const AGE_HEADER = Buffer.from('age') |
There was a problem hiding this comment.
I am not entirely sure why age here is lowercased. If it is Age, we can re-use getWellKnownHeaderBuffer.
|
Guys. Please stop with the nits for now and open follow up PRs.we need to land this. |
Co-authored-by: Aras Abbasi <[email protected]>
Co-authored-by: Aras Abbasi <[email protected]>
Uzlopak
left a comment
There was a problem hiding this comment.
I dont see any obvious code smell any more. :)
LGTM
|
Unrelated Test is flaky. see #3731 |
Implements bare-bones opt-in http caching as per rfc9111. Bare-bones in this case means what's required by the spec and a few extra bits, with more coming in future prs.
Opening as a draft since there's still some more work to be done (mostly tests, but a bit more functionality-wise)No request cache directives are supported at this time, this will come later.
Response caching directives supported:
publicprivates-maxagemax-ageExpiresheaderno-cacheno-storestale-while-revalidateThis relates to...
Closes #3231
Closes #2760
Closes #2256
Closes #1146
Changes
Features
Bug Fixes
n/a
Breaking Changes and Deprecations
n/a
Status