Skip to content

Commit

Permalink
feat: add LastModified header to items returned from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambie committed Jan 31, 2019
1 parent e9be2c0 commit 5f0ce1b
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 41 deletions.
8 changes: 7 additions & 1 deletion dadi/lib/handlers/image.js
Expand Up @@ -258,6 +258,10 @@ ImageHandler.prototype.get = function () {
this.contentType = metadata.contentType || 'application/json'
}

if (metadata && metadata.lastModified) {
this.storageHandler.lastModified = metadata.lastModified
}

return help.streamToBuffer(cacheStream)
})
}
Expand Down Expand Up @@ -306,7 +310,9 @@ ImageHandler.prototype.get = function () {
}).then(result => {
// Cache the file if it's not already cached.
if (!this.isCached) {
let metadata
let metadata = {
lastModified: this.storageHandler.getLastModified ? this.storageHandler.getLastModified() : null
}

if (this.storageHandler.notFound) {
metadata = {
Expand Down

0 comments on commit 5f0ce1b

Please sign in to comment.