Skip to content
Myr

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

4 files+9 added−10 removed

modified:lib/request.js+4 added-4 removed
8 unmodified lines
9 * Module dependencies.10 */1112var 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');1617/**18 * Default flash formatters.19 *
84 unmodified lines
104 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 }110111 // Check if we have a direct match112 if (~accept.indexOf(type)) return true;
145 unmodified lines
258 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 lines
modified:lib/response.js+3 added-4 removed
13 unmodified lines
14 , path = require('path')15 , utils = require('connect').utils16 , parseRange = require('./utils').parseRange17 , res = http.ServerResponse.prototype18 , mime = utils.mime;18 , mime = require('mime');1920/**21 * Header fields supporting multiple values.22 *
161 unmodified lines
184 });185};186187/**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 lines
203 * @api public204 */205206res.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};209210/**211 * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
177 unmodified lines
modified:lib/view.js+1 added-2 removed
16 unmodified lines
17 , 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');2223/**24 * Memory cache.25 *
252 unmodified lines
modified:package.json+1 added