Permalink
Browse files

Bundling mime module rather than keep around our own mime-map.

  • Loading branch information...
1 parent b211200 commit 1268195b75bd5bb3954b4c4f2d9feb80a97994d1 @mikeal mikeal committed Aug 29, 2012
Showing with 3 additions and 155 deletions.
  1. +2 −2 main.js
  2. +0 −152 mimetypes.js
  3. +1 −1 tests/test-pipes.js
View
@@ -19,7 +19,6 @@ var http = require('http')
, util = require('util')
, stream = require('stream')
, qs = require('querystring')
- , mimetypes = require('./mimetypes')
, oauth = require('./oauth')
, uuid = require('./uuid')
, ForeverAgent = require('./forever')
@@ -29,6 +28,7 @@ var http = require('http')
, tunnel = require('./tunnel')
, aws = require('./aws')
+ , mime = require('mime')
, FormData = require('form-data')
;
@@ -336,7 +336,7 @@ Request.prototype.init = function (options) {
self.src = src
if (isReadStream(src)) {
if (!self.headers['content-type'] && !self.headers['Content-Type'])
- self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1))
+ self.headers['content-type'] = mime.lookup(src.path)
} else {
if (src.headers) {
for (var i in src.headers) {
View
@@ -1,152 +0,0 @@
-// from http://github.com/felixge/node-paperboy
-exports.types = {
- "3gp":"video/3gpp",
- "aiff":"audio/x-aiff",
- "arj":"application/x-arj-compressed",
- "asf":"video/x-ms-asf",
- "asx":"video/x-ms-asx",
- "au":"audio/ulaw",
- "avi":"video/x-msvideo",
- "bcpio":"application/x-bcpio",
- "ccad":"application/clariscad",
- "cod":"application/vnd.rim.cod",
- "com":"application/x-msdos-program",
- "cpio":"application/x-cpio",
- "cpt":"application/mac-compactpro",
- "csh":"application/x-csh",
- "css":"text/css",
- "deb":"application/x-debian-package",
- "dl":"video/dl",
- "doc":"application/msword",
- "drw":"application/drafting",
- "dvi":"application/x-dvi",
- "dwg":"application/acad",
- "dxf":"application/dxf",
- "dxr":"application/x-director",
- "etx":"text/x-setext",
- "ez":"application/andrew-inset",
- "fli":"video/x-fli",
- "flv":"video/x-flv",
- "gif":"image/gif",
- "gl":"video/gl",
- "gtar":"application/x-gtar",
- "gz":"application/x-gzip",
- "hdf":"application/x-hdf",
- "hqx":"application/mac-binhex40",
- "html":"text/html",
- "ice":"x-conference/x-cooltalk",
- "ico":"image/x-icon",
- "ief":"image/ief",
- "igs":"model/iges",
- "ips":"application/x-ipscript",
- "ipx":"application/x-ipix",
- "jad":"text/vnd.sun.j2me.app-descriptor",
- "jar":"application/java-archive",
- "jpeg":"image/jpeg",
- "jpg":"image/jpeg",
- "js":"text/javascript",
- "json":"application/json",
- "latex":"application/x-latex",
- "lsp":"application/x-lisp",
- "lzh":"application/octet-stream",
- "m":"text/plain",
- "m3u":"audio/x-mpegurl",
- "m4v":"video/mp4",
- "man":"application/x-troff-man",
- "me":"application/x-troff-me",
- "midi":"audio/midi",
- "mif":"application/x-mif",
- "mime":"www/mime",
- "mkv":" video/x-matrosk",
- "movie":"video/x-sgi-movie",
- "mp4":"video/mp4",
- "mp41":"video/mp4",
- "mp42":"video/mp4",
- "mpg":"video/mpeg",
- "mpga":"audio/mpeg",
- "ms":"application/x-troff-ms",
- "mustache":"text/plain",
- "nc":"application/x-netcdf",
- "oda":"application/oda",
- "ogm":"application/ogg",
- "pbm":"image/x-portable-bitmap",
- "pdf":"application/pdf",
- "pgm":"image/x-portable-graymap",
- "pgn":"application/x-chess-pgn",
- "pgp":"application/pgp",
- "pm":"application/x-perl",
- "png":"image/png",
- "pnm":"image/x-portable-anymap",
- "ppm":"image/x-portable-pixmap",
- "ppz":"application/vnd.ms-powerpoint",
- "pre":"application/x-freelance",
- "prt":"application/pro_eng",
- "ps":"application/postscript",
- "qt":"video/quicktime",
- "ra":"audio/x-realaudio",
- "rar":"application/x-rar-compressed",
- "ras":"image/x-cmu-raster",
- "rgb":"image/x-rgb",
- "rm":"audio/x-pn-realaudio",
- "rpm":"audio/x-pn-realaudio-plugin",
- "rtf":"text/rtf",
- "rtx":"text/richtext",
- "scm":"application/x-lotusscreencam",
- "set":"application/set",
- "sgml":"text/sgml",
- "sh":"application/x-sh",
- "shar":"application/x-shar",
- "silo":"model/mesh",
- "sit":"application/x-stuffit",
- "skt":"application/x-koan",
- "smil":"application/smil",
- "snd":"audio/basic",
- "sol":"application/solids",
- "spl":"application/x-futuresplash",
- "src":"application/x-wais-source",
- "stl":"application/SLA",
- "stp":"application/STEP",
- "sv4cpio":"application/x-sv4cpio",
- "sv4crc":"application/x-sv4crc",
- "svg":"image/svg+xml",
- "swf":"application/x-shockwave-flash",
- "tar":"application/x-tar",
- "tcl":"application/x-tcl",
- "tex":"application/x-tex",
- "texinfo":"application/x-texinfo",
- "tgz":"application/x-tar-gz",
- "tiff":"image/tiff",
- "tr":"application/x-troff",
- "tsi":"audio/TSP-audio",
- "tsp":"application/dsptype",
- "tsv":"text/tab-separated-values",
- "unv":"application/i-deas",
- "ustar":"application/x-ustar",
- "vcd":"application/x-cdlink",
- "vda":"application/vda",
- "vivo":"video/vnd.vivo",
- "vrm":"x-world/x-vrml",
- "wav":"audio/x-wav",
- "wax":"audio/x-ms-wax",
- "webm":"video/webm",
- "wma":"audio/x-ms-wma",
- "wmv":"video/x-ms-wmv",
- "wmx":"video/x-ms-wmx",
- "wrl":"model/vrml",
- "wvx":"video/x-ms-wvx",
- "xbm":"image/x-xbitmap",
- "xlw":"application/vnd.ms-excel",
- "xml":"text/xml",
- "xpm":"image/x-xpixmap",
- "xwd":"image/x-xwindowdump",
- "xyz":"chemical/x-pdb",
- "zip":"application/zip"
-};
-
-exports.lookup = function(ext, defaultType) {
- defaultType = defaultType || 'application/octet-stream';
-
- return (ext in exports.types)
- ? exports.types[ext]
- : defaultType;
-};
View
@@ -99,7 +99,7 @@ s.listen(s.port, function () {
})
s.on('/pushjs', function (req, resp) {
if (req.method === "PUT") {
- assert.equal(req.headers['content-type'], 'text/javascript');
+ assert.equal(req.headers['content-type'], 'application/javascript');
check();
}
})

0 comments on commit 1268195

Please sign in to comment.