feat: complete TASK-WP0-06 public cache
This commit is contained in:
@@ -223,7 +223,9 @@ export async function createApp(options: CreateAppOptions = {}) {
|
||||
: undefined;
|
||||
if (!resource) return reply.code(404).send();
|
||||
reply.type(resource.mimeType);
|
||||
reply.header("Cache-Control", "public, max-age=31536000, immutable");
|
||||
reply.header("Content-Disposition", "inline");
|
||||
reply.header("ETag", `"sha256-${resource.sha256}"`);
|
||||
return resource.bytes;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -89,6 +89,7 @@ export interface PublicAssetPayload {
|
||||
bytes: Buffer;
|
||||
mimeType: string;
|
||||
resourceVersion: string;
|
||||
sha256: string;
|
||||
}
|
||||
|
||||
export interface PublicAssetResolver {
|
||||
@@ -333,6 +334,7 @@ export function createPublicAssetResolver(input: {
|
||||
bytes,
|
||||
mimeType: entry.mimeType,
|
||||
resourceVersion: entry.resourceVersion,
|
||||
sha256,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user