pass HTTP metadata in S3/R2 Source impls

This commit is contained in:
Brandon Liu
2022-11-22 14:43:15 +08:00
parent a619aa84e2
commit f457724da1
3 changed files with 15 additions and 3 deletions

View File

@@ -100,7 +100,12 @@ class S3Source implements Source {
const arr = await resp.Body!.transformToByteArray();
return { data: arr.buffer };
return {
data: arr.buffer,
etag: resp.ETag,
expires: resp.Expires?.toISOString(),
cacheControl: resp.CacheControl,
};
}
}
@@ -156,7 +161,7 @@ export const handler = async (
// TODO: metadata and TileJSON
if (process.env.CORS) {
headers['Access-Control-Allow-Origin'] = process.env.CORS;
headers["Access-Control-Allow-Origin"] = process.env.CORS;
}
const source = new S3Source(name);