Skip to content
Myr

Merge tag '3.12.0'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parents f498b66, 75422c1 · Browse files · 7 files+64 added−88 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+64 added−88 removed

  • tests:+1 added−22 removed
  • other:+63 added−66 removed

7 files+64 added−88 removed

modified:lib/application.js+2 added-2 removed
11 unmodified lines
12var View = require('./view');13var http = require('http');14var compileETag = require('./utils').compileETag;15var compileTrust = require('./utils').compileTrust;16var deprecate = require('./utils').deprecate;16var deprecate = require('depd')('express');17var resolve = require('path').resolve;1819/**20 * Application prototype.
427 unmodified lines
448};449450// del -> delete alias451452app.del = deprecate(app.delete, 'app.del: Use app.delete instead');452app.del = deprecate.function(app.delete, 'app.del: Use app.delete instead');453454/**455 * Render the given view `name` name with `options`456 * and a callback accepting an error and the
93 unmodified lines
modified:lib/response.js+11 added-19 removed
1/**2 * Module dependencies.3 */45var deprecate = require('depd')('express');6var escapeHtml = require('escape-html');7var http = require('http');8var path = require('path');9var mixin = require('utils-merge');
1 unmodified line
11var normalizeType = require('./utils').normalizeType;12var normalizeTypes = require('./utils').normalizeTypes;13var setCharset = require('./utils').setCharset;14var contentDisposition = require('./utils').contentDisposition;14var deprecate = require('./utils').deprecate;15var statusCodes = http.STATUS_CODES;16var cookie = require('cookie');17var send = require('send');18var basename = path.basename;
166 unmodified lines
185 if (2 == arguments.length) {186 // res.json(body, status) backwards compat187 if ('number' == typeof arguments[1]) {188 this.statusCode = arguments[1];189 return 'number' === typeof obj190 ? jsonNumDeprecated.call(this, obj)191 : jsonDeprecated.call(this, obj);189 if (typeof obj === 'number') {190 deprecate('res.json(obj, status): Use res.json(status, obj) instead');191 } else {192 deprecate('res.json(num, status): Use res.status(status).json(num) instead');193 }194 } else {195 this.statusCode = obj;196 obj = arguments[1];197 }
10 unmodified lines
208209 return this.send(body);210};211210var jsonDeprecated = deprecate(res.json,211 'res.json(obj, status): Use res.json(status, obj) instead');212213var jsonNumDeprecated = deprecate(res.json,214 'res.json(num, status): Use res.status(status).json(num) instead');215212/**213 * Send JSON response with JSONP callback support.214 *215 * Examples:
11 unmodified lines
227 if (2 == arguments.length) {228 // res.json(body, status) backwards compat229 if ('number' == typeof arguments[1]) {230 this.statusCode = arguments[1];235 return 'number' === typeof obj236 ? jsonpNumDeprecated.call(this, obj)237 : jsonpDeprecated.call(this, obj);231 if (typeof obj === 'number') {232 deprecate('res.jsonp(obj, status): Use res.jsonp(status, obj) instead');233 } else {234 deprecate('res.jsonp(num, status): Use res.status(status).jsonp(num) instead');235 }236 } else {237 this.statusCode = obj;238 obj = arguments[1];239 }
25 unmodified lines
265266 return this.send(body);267};268271var jsonpDeprecated = deprecate(res.json,272 'res.jsonp(obj, status): Use res.jsonp(status, obj) instead');273274var jsonpNumDeprecated = deprecate(res.json,275 'res.jsonp(num, status): Use res.status(status).jsonp(num) instead');276269/**270 * Transfer the file at the given `path`.271 *272 * Automatically sets the _Content-Type_ response header field.
503 unmodified lines
modified:lib/utils.js+7 added-45 removed
4 unmodified lines
5var mime = require('send').mime;6var crc32 = require('buffer-crc32');7var crypto = require('crypto');8var basename = require('path').basename;9var deprecate = require('util').deprecate;9var proxyaddr = require('proxy-addr');10var typer = require('media-typer');1112/**13 * Simple detection of charset parameter in content-type14 */15var charsetRegExp = /;\s*charset\s*=/;1617/**18 * Deprecate function, like core `util.deprecate`,19 * but with NODE_ENV and color support.20 *21 * @param {Function} fn22 * @param {String} msg23 * @return {Function}24 * @api private25 */2627exports.deprecate = function(fn, msg){28 if (process.env.NODE_ENV === 'test') return fn;2930 // prepend module name31 msg = 'express: ' + msg;3233 if (process.stderr.isTTY) {34 // colorize35 msg = '\x1b[31;1m' + msg + '\x1b[0m';36 }3738 return deprecate(fn, msg);39};4041/**13 * Return strong ETag for `body`.14 *15 * @param {String|Buffer} body16 * @param {String} [encoding]
225 unmodified lines
242243exports.setCharset = function(type, charset){244 if (!type || !charset) return type;245275 var exists = charsetRegExp.test(type);246 // parse type247 var parsed = typer.parse(type);248277 // removing existing charset278 if (exists) {279 var parts = type.split(';');249 // set charset250 parsed.parameters.charset = charset;251281 for (var i = 1; i < parts.length; i++) {282 if (charsetRegExp.test(';' + parts[i])) {283 parts.splice(i, 1);284 break;285 }286 }287288 type = parts.join(';');289 }290291 return type + '; charset=' + charset;252 // format type253 return typer.format(parsed);254};
modified:test/support/env.js+1 added
modified:test/utils.js-22 removed
modified:History.md+41 added
1unreleased2==========34 * deprecate things with `depd` module5 * use `media-typer` to alter content-type charset674.4.4 / 2014-06-208==================910 * fix `res.attachment` Unicode filenames in Safari
190 unmodified lines
201 - `app.router()` - returns the app Router instance202 - `app.route()` - Proxy to the app's `Router#route()` method to create a new route203 - Router & Route - public API2042053.12.0 / 2014-06-21206===================207208 * use `media-typer` to alter content-type charset209 * deps: connect@2.21.0210 - deprecate `connect(middleware)` -- use `app.use(middleware)` instead211 - deprecate `connect.createServer()` -- use `connect()` instead212 - fix `res.setHeader()` patch to work with with get -> append -> set pattern213 - deps: compression@~1.0.8214 - deps: errorhandler@~1.1.1215 - deps: express-session@~1.5.0216 - deps: serve-index@~1.1.32172183.11.0 / 2014-06-19219===================220221 * deprecate things with `depd` module222 * deps: buffer-crc32@0.2.3223 * deps: connect@2.20.2224 - deprecate `verify` option to `json` -- use `body-parser` module directly225 - deprecate `verify` option to `urlencoded` -- use `body-parser` module directly226 - deprecate things with `depd` module227 - use `finalhandler` for final response handling228 - use `media-typer` to parse `content-type` for charset229 - deps: body-parser@1.4.3230 - deps: connect-timeout@1.1.1231 - deps: cookie-parser@1.3.1232 - deps: csurf@1.2.2233 - deps: errorhandler@1.1.0234 - deps: express-session@1.4.0235 - deps: multiparty@3.2.9236 - deps: serve-index@1.1.2237 - deps: type-is@1.3.1238 - deps: vhost@2.0.02392403.10.5 / 2014-06-11241===================242243 * deps: connect@2.19.6
1443 unmodified lines
modified:package.json+2 added