From 166256001fc99c65360fc71b19f9796f2524c915 Mon Sep 17 00:00:00 2001 From: cel Date: Fri, 24 Jan 2020 10:26:37 -0500 Subject: Support blob contentType and gzip query parameters --- lib/serve.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') 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) -- cgit v1.2.3