From eb3b1b4ce8e0545832676289deb6e48bde5465fd Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Thu, 9 Aug 2018 11:03:01 -0700 Subject: [PATCH] chore(deps): update mime -> 2.3.1 (#3107) This is the same as @dignifiedrequire #2997 first commit --- lib/middleware/common.js | 6 +++--- package.json | 2 +- test/unit/web-server.spec.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/middleware/common.js b/lib/middleware/common.js index 2a001dd35..368abc830 100644 --- a/lib/middleware/common.js +++ b/lib/middleware/common.js @@ -88,7 +88,7 @@ function createServeFile (fs, directory, config) { // serve from cache if (content && !doNotCache) { - response.setHeader('Content-Type', mime.lookup(filepath, 'text/plain')) + response.setHeader('Content-Type', mime.getType(filepath, 'text/plain')) // call custom transform fn to transform the data responseData = (transform && transform(content)) || content @@ -108,7 +108,7 @@ function createServeFile (fs, directory, config) { cache[filepath] = data.toString() } - response.setHeader('Content-Type', mime.lookup(filepath, 'text/plain')) + response.setHeader('Content-Type', mime.getType(filepath, 'text/plain')) // call custom transform fn to transform the data responseData = (transform && transform(data.toString())) || data @@ -136,7 +136,7 @@ function initializeMimeTypes (config) { _.forEach(config.mime, function (value, key) { const map = {} map[key] = value - mime.define(map) + mime.define(map, true) }) } } diff --git a/package.json b/package.json index f64a05bdc..973bd4edd 100644 --- a/package.json +++ b/package.json @@ -374,7 +374,7 @@ "isbinaryfile": "^3.0.0", "lodash": "^4.17.4", "log4js": "^3.0.0", - "mime": "^1.3.4", + "mime": "^2.3.1", "minimatch": "^3.0.2", "optimist": "^0.6.1", "qjobs": "^1.1.4", diff --git a/test/unit/web-server.spec.js b/test/unit/web-server.spec.js index 6d56cb04c..e7ceadc60 100644 --- a/test/unit/web-server.spec.js +++ b/test/unit/web-server.spec.js @@ -90,11 +90,11 @@ describe('web-server', () => { }) it('should setup mime', () => { - expect(mime.lookup('/my.custom')).to.equal('custom/custom') + expect(mime.getType('/my.custom')).to.equal('custom/custom') }) it('should keep default mimes', () => { - expect(mime.lookup('/my.html')).to.equal('text/html') + expect(mime.getType('/my.html')).to.equal('text/html') }) it('should serve client.html', () => {