Skip to content

Commit

Permalink
Mime config option support karma-runner#1735 Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
comdiv committed Dec 1, 2015
1 parent 8f61eb2 commit b6f0a41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/middleware/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,20 @@ var setHeavyCacheHeaders = function (response) {
response.setHeader('Cache-Control', 'public, max-age=31536000')
}

var initializeMimeTypes = function (config){
if(config && config.mime){
for (var mimeType in config.mime) {
var map = {}
map[mimeType] = config.mime[mimeType]
mime.define(map)
}
}
}

// PUBLIC API
exports.PromiseContainer = PromiseContainer
exports.createServeFile = createServeFile
exports.setNoCacheHeaders = setNoCacheHeaders
exports.setHeavyCacheHeaders = setHeavyCacheHeaders
exports.initializeMimeTypes = initializeMimeTypes
exports.serve404 = serve404
1 change: 1 addition & 0 deletions lib/web-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ createCustomHandler.$inject = ['customFileHandlers', 'config.basePath']

var createWebServer = function (injector, emitter, fileList) {
var config = injector.get('config')
common.initializeMimeTypes(config);
var serveStaticFile = common.createServeFile(fs, path.normalize(__dirname + '/../static'), config)
var serveFile = common.createServeFile(fs, null, config)
var filesPromise = new common.PromiseContainer()
Expand Down

0 comments on commit b6f0a41

Please sign in to comment.