create project
This commit is contained in:
21
kitabcitab/node_modules/next/dist/server/send-payload/revalidate-headers.js
generated
vendored
Normal file
21
kitabcitab/node_modules/next/dist/server/send-payload/revalidate-headers.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.setRevalidateHeaders = setRevalidateHeaders;
|
||||
function setRevalidateHeaders(res, options) {
|
||||
if (options.private || options.stateful) {
|
||||
if (options.private || !res.hasHeader("Cache-Control")) {
|
||||
res.setHeader("Cache-Control", `private, no-cache, no-store, max-age=0, must-revalidate`);
|
||||
}
|
||||
} else if (typeof options.revalidate === "number") {
|
||||
if (options.revalidate < 1) {
|
||||
throw new Error(`invariant: invalid Cache-Control duration provided: ${options.revalidate} < 1`);
|
||||
}
|
||||
res.setHeader("Cache-Control", `s-maxage=${options.revalidate}, stale-while-revalidate`);
|
||||
} else if (options.revalidate === false) {
|
||||
res.setHeader("Cache-Control", `s-maxage=31536000, stale-while-revalidate`);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=revalidate-headers.js.map
|
||||
Reference in New Issue
Block a user