Skip to content

Commit fda65b8

Browse files
committed
feat: add etag to image function
1 parent 8b8b633 commit fda65b8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib/templates/imageFunction.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const sharp = require('sharp')
33
const fetch = require('node-fetch')
44
const imageType = require('image-type')
55
const isSvg = require('is-svg')
6+
const etag = require('etag')
67

78
// 6MB is hard max Lambda response size
89
const MAX_RESPONSE_SIZE = 6291456
@@ -116,6 +117,7 @@ const handler = async (event) => {
116117
statusCode: 200,
117118
headers: {
118119
'Content-Type': `image/${info.format}`,
120+
etag: etag(imageBuffer),
119121
},
120122
body: imageBuffer.toString('base64'),
121123
isBase64Encoded: true,

0 commit comments

Comments
 (0)