Fixing cache control
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Fabian Stamm
2020-08-02 16:42:05 +02:00
parent cece103504
commit f69e40ae9e
3 changed files with 37 additions and 10 deletions

View File

@ -23,6 +23,11 @@ export default function views(g: ABC.Application) {
packages = await db.package.find({});
}
ctx.render("index", {
packages,
search,
});
const etag =
"W/" +
Hash.createHash("sha3-256")
@ -36,12 +41,8 @@ export default function views(g: ABC.Application) {
)
.toString("base64");
ctx.response.headers.set("e-tag", etag);
return ctx.render("index", {
packages,
search,
});
ctx.response.headers.set("cache-control", CACHE_CONTROL);
ctx.response.headers.set("E-Tag", etag);
});
g.get("/package/:package", async (ctx) => {
let [packageName, packageVersion] = extractPackagePath(