Permalink
Browse files

Merge pull request #20 from kesla/master

Use node-mime for mimetypes
  • Loading branch information...
mikeal committed Aug 6, 2012
2 parents 459f0fc + 81a392b commit a070244b2370e1ec9919ef96f3455eca0600f78a
Showing with 5 additions and 151 deletions.
  1. +3 −3 main.js
  2. +0 −147 mimetypes.js
  3. +1 −0 package.json
  4. +1 −1 test/test.js
View
@@ -3,7 +3,7 @@ var fs = require('fs')
, crypto = require('crypto')
, stream = require('stream')
, path = require('path')
, mimetypes = require('./mimetypes')
, mime = require('mime')
, rfc822 = require('./rfc822')
;
@@ -30,7 +30,7 @@ function File (options) {
this.buffering = true
this.mimetype = options.mimetype || mimetypes.lookup(this.path.slice(this.path.lastIndexOf('.')+1))
this.mimetype = options.mimetype || mime.lookup(this.path.slice(this.path.lastIndexOf('.')+1))
var stopBuffering = function () {
self.buffering = false
@@ -152,7 +152,7 @@ function File (options) {
if (!err && stats.isDirectory()) {
self.path = path.join(self.path, self.index)
self.mimetype = mimetypes.lookup(self.path.slice(self.path.lastIndexOf('.')+1))
self.mimetype = mime.lookup(self.path.slice(self.path.lastIndexOf('.')+1))
fs.stat(self.path, finish)
return
} else {
View

This file was deleted.

Oops, something went wrong.
View
@@ -10,6 +10,7 @@
"engines": {
"node": "*"
},
"dependencies": { "mime": ">= 1.2.6" },
"scripts": {"test": "node test/test.js"},
"main": "./main"
}
View
@@ -154,7 +154,7 @@ function testhttp () {
var x = request.get(url+'/test-resp', function (e, resp) {
if (e) throw e
assert.equal(resp.statusCode, 200)
assert.equal(resp.headers['content-type'], 'text/javascript')
assert.equal(resp.headers['content-type'], 'application/javascript')
console.log("Passed GET file without piping request")
})
x.pipe(new FileValidator(testfile))

0 comments on commit a070244

Please sign in to comment.