Skip to content

Commit

Permalink
Upgrade mime dep, fix content-length
Browse files Browse the repository at this point in the history
  • Loading branch information
omphalos committed Jul 22, 2018
1 parent a0905e7 commit 865dd52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"http-proxy": "0.10.3",
"querystring": "0.2.0",
"path": "0.4.9",
"mime": "1.2.11"
"mime": "2.3.1"
},
"license": "MIT",
"engine": { "node": ">=0.10.19" },
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var server = http.createServer(function (req, res) {
isEarhornDir ? __dirname + '/..' + pathname :
folder + pathname)

var type = mime.lookup(filePath)
var type = mime.getType(filePath)
, isJs = type === 'application/javascript'

var matches = patterns.filter(function(p) {
Expand Down Expand Up @@ -153,7 +153,7 @@ var server = http.createServer(function (req, res) {
data = 'earhorn$("' + ref + '", true, function() {' + data + '})()'
}

res.setHeader('Content-Length', Buffer.byteLength(data))
res.setHeader('Content-Length', stats.size)

return req.method === 'HEAD' ? res.end() : res.end(data)
})
Expand Down

0 comments on commit 865dd52

Please sign in to comment.