aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2020-01-24 10:26:37 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2020-01-24 10:28:19 -0500
commit166256001fc99c65360fc71b19f9796f2524c915 (patch)
tree8937bd68c2b82b92f56f7c604525f824462b90dd /lib
parentb89cb9e2e4c5564ad3803cee6f962ec8e65e8018 (diff)
downloadpatchfoo-166256001fc99c65360fc71b19f9796f2524c915.tar.gz
patchfoo-166256001fc99c65360fc71b19f9796f2524c915.zip
Support blob contentType and gzip query parameters
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index f7c2491..aad7159 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -1571,6 +1571,10 @@ Serve.prototype.blob = function (id, path) {
self.res.setHeader('Content-Length', size)
if (self.query.name) self.res.setHeader('Content-Disposition',
'inline; filename='+encodeDispositionFilename(self.query.name))
+ if (self.query.gzip)
+ res.setHeader('Content-Encoding', 'gzip')
+ if (self.query.contentType)
+ res.setHeader('Content-Type', self.query.contentType)
self.res.setHeader('Cache-Control', 'public, max-age=315360000')
self.res.setHeader('etag', etag)
self.res.writeHead(200)
@@ -1653,6 +1657,10 @@ Serve.prototype.image = function (path) {
self.res.setHeader('Content-Length', data.length)
if (self.query.name) self.res.setHeader('Content-Disposition',
'inline; filename='+encodeDispositionFilename(self.query.name))
+ if (self.query.gzip)
+ res.setHeader('Content-Encoding', 'gzip')
+ if (self.query.contentType)
+ res.setHeader('Content-Type', self.query.contentType)
self.res.setHeader('Cache-Control', 'public, max-age=315360000')
self.res.setHeader('ETag', etag)
self.res.writeHead(200)