From 7e8e6b8627ad24b63c91aeb2917e5e08cf902305 Mon Sep 17 00:00:00 2001 From: cel Date: Sat, 21 Apr 2018 22:02:34 -1000 Subject: Support missing web content-type otherwise it gets set to "false" which confuses some browsers --- lib/serve.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/serve.js b/lib/serve.js index 4b9eb1b..e50caa8 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -2671,6 +2671,8 @@ Serve.prototype.web = function (url) { components[0] = decodeURIComponent(components[0]) var type = mime.lookup(components[components.length - 1]) + var headers = {} + if (type) headers['Content-Type'] = type webresolve(this.app.sbot, components, function (err, res) { if (err) { return pull( @@ -2678,9 +2680,10 @@ Serve.prototype.web = function (url) { self.respondSink(404) ) } + headers['Content-Length'] = res.length return pull( pull.once(res), - self.respondSink(200, {'content-type': type, 'content-length': res.length}) + self.respondSink(200, headers) ) }) } -- cgit v1.2.3