Skip to content

Commit

Permalink
chore(deps): update mime -> 2.3.1 (#3107)
Browse files Browse the repository at this point in the history
This is the same as @dignifiedrequire #2997 first commit
  • Loading branch information
johnjbarton authored Aug 9, 2018
1 parent 732396a commit eb3b1b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/middleware/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/web-server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit eb3b1b4

Please sign in to comment.