diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-04-21 22:02:34 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-04-21 22:02:34 -1000 |
commit | 7e8e6b8627ad24b63c91aeb2917e5e08cf902305 (patch) | |
tree | 002e0d42d95e7611e558329f03e99a27b3873aa6 | |
parent | 47a922112154cbc356eccd14c6e4f23ed668c322 (diff) | |
download | patchfoo-7e8e6b8627ad24b63c91aeb2917e5e08cf902305.tar.gz patchfoo-7e8e6b8627ad24b63c91aeb2917e5e08cf902305.zip |
Support missing web content-type
otherwise it gets set to "false" which confuses some browsers
-rw-r--r-- | lib/serve.js | 5 |
1 files changed, 4 insertions, 1 deletions
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) ) }) } |