replaced connect.utils.mime() with mime module
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 2b63568 · Browse files · 4 files·+9 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+9 added−10 removed
- other:+9 added−10 removed
Provenance
- Commit
d37ad85- Tree
18069d4- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
2b63568
4 files changed+9 added−10 removed
modified:lib/request.js+4 added-4 removed
8 unmodified lines9 * Module dependencies.10 */11 12 var http = require('http')13+ , req = http.IncomingMessage.prototype14 , utils = require('./utils')14- , mime = require('connect').utils.mime15- , req = http.IncomingMessage.prototype;15+ , mime = require('mime');16 17 /**18 * Default flash formatters.19 *84 unmodified lines104 return true;105 } else if (type) {106 // Allow "html" vs "text/html" etc107 if (type.indexOf('/') < 0) {108- type = mime.types['.' + type];108+ type = mime.lookup(type);109 }110 111 // Check if we have a direct match112 if (~accept.indexOf(type)) return true;145 unmodified lines258 var fn = this.app.is(type);259 if (fn) return fn(this);260 var contentType = this.headers['content-type'];261 if (!contentType) return;262- if (!~type.indexOf('/')) type = mime.type('.' + type);262+ if (!~type.indexOf('/')) type = mime.lookup(type);263 // TODO: remove when connect no longer appends charset...264 if (~type.indexOf(';')) type = type.split(';')[0];265 if (~type.indexOf('*')) {266 type = type.split('/')22 unmodified linesmodified:lib/response.js+3 added-4 removed
13 unmodified lines14 , path = require('path')15 , utils = require('connect').utils16 , parseRange = require('./utils').parseRange17 , res = http.ServerResponse.prototype18- , mime = utils.mime;18+ , mime = require('mime');19 20 /**21 * Header fields supporting multiple values.22 * 161 unmodified lines184 });185 };186 187 /**188- * Set _Content-Type_ response header passed through `mime.type()`.188+ * Set _Content-Type_ response header passed through `mime.lookup()`.189 *190 * Examples:191 *192 * var filename = 'path/to/image.png';10 unmodified lines203 * @api public204 */205 206 res.contentType = function(type){207- if (!~type.indexOf('.')) type = '.' + type;208- return this.header('Content-Type', mime.type(type));207+ return this.header('Content-Type', mime.lookup(type));208 };209 210 /**211 * Set _Content-Disposition_ header to _attachment_ with optional `filename`.177 unmodified linesmodified:lib/view.js+1 added-2 removed
16 unmodified lines17 , clone = require('./utils').clone18 , View = require('./view/view')19 , Partial = require('./view/partial')20 , merge = utils.merge21- , http = require('http')22- , mime = utils.mime;21+ , http = require('http');22 23 /**24 * Memory cache.25 *252 unmodified linesmodified:package.json+1 added
9 unmodified lines1011121314151617183 unmodified lines9 unmodified lines { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } ], "dependencies": { "connect": ">= 0.5.7", "mime": ">= 0.0.1", "qs": ">= 0.0.6" }, "keywords": ["framework", "sinatra", "web", "rest", "restful"], "main": "index",3 unmodified lines