Skip to content

Commit

Permalink
Merge 2950b00 into 880c518
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambie committed Jan 31, 2019
2 parents 880c518 + 2950b00 commit 81d0c84
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dadi/lib/controller/index.js
Expand Up @@ -249,7 +249,7 @@ Controller.prototype.addCacheControlHeader = function (res, handler, domain) {
let key = Object.keys(obj)[0]
let value = obj[key]

if (handler.getFilename && (mime.lookup(handler.getFilename()) === key)) {
if (handler.getFilename && (mime.getType(handler.getFilename()) === key)) {
setHeader(value)
}
})
Expand Down
2 changes: 1 addition & 1 deletion dadi/lib/handlers/default.js
Expand Up @@ -96,7 +96,7 @@ DefaultHandler.prototype.getContentType = function () {
return 'text/html'
}

return mime.lookup(newUrl)
return mime.getType(newUrl)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion dadi/lib/handlers/factory.js
Expand Up @@ -40,7 +40,7 @@ HandlerFactory.prototype.create = function (req, mimetype) {
const parsedUrl = url.parse(req.url, true)
const pathComponents = parsedUrl.pathname.slice(1).split('/')

let format = mimetype ? mime.extension(mimetype) : null
let format = mimetype ? mime.getExtension(mimetype) : null

// version 1 matches a string like /jpg/80/0/0/640/480/ at the beginning of the url pathname
const v1pattern = /^\/[a-z]{3,4}\/[0-9]+\/[0-1]+\/[0-1]+\/[0-9]+\/[0-9]+\//gi
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -30,7 +30,7 @@
"color-namer": "^1.1.0",
"colors": "^1.1.2",
"compressible": "^2.0.13",
"concat-stream": "^1.5.1",
"concat-stream": "^2.0.0",
"console-stamp": "^0.2.2",
"convict": "^4.0.0",
"cron": "^1.4.0",
Expand All @@ -49,7 +49,7 @@
"jsonwebtoken": "^8.2.1",
"length-stream": "~0.1.1",
"maxmind": "^2.2.0",
"mime": "^1.3.4",
"mime": "^2.4.0",
"mkdirp": "^0.5.1",
"node-minify": "^3.3.0",
"node-vibrant": "^2.1.2",
Expand Down
3 changes: 2 additions & 1 deletion test/acceptance/controller.js
Expand Up @@ -279,7 +279,8 @@ describe('Controller', function () {

request(cdnUrl)
.get('/test.jpg')
.expect(200, (err, res) => {
.expect(200)
.end((err, res) => {
res.headers['cache-control'].should.eql(cacheControl.default)

request(cdnUrl)
Expand Down

0 comments on commit 81d0c84

Please sign in to comment.