Merge tag '4.14.1'
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 ab1c9e9, 0437c51 · Browse files · 15 files·+74 added−76 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
15 files+74 added−76 removed
- tests:+26 added−6 removed
- other:+48 added−70 removed
Provenance
- Commit
bcbb9d5- Tree
c8f2868- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent 1
ab1c9e9- Parent 2
0437c51
15 files changed+74 added−76 removed
deleted:examples/big-view/index.js-31 removed
12345678910111213141516171819202122232425262728293031/** * Module dependencies. */
var express = require('../..');var logger = require('morgan');var app = express();
app.set('views', __dirname);app.set('view engine', 'jade');
var pets = [];
var n = 1000;while (n--) { pets.push({ name: 'Tobi', age: 2, species: 'ferret' }); pets.push({ name: 'Loki', age: 1, species: 'ferret' }); pets.push({ name: 'Jane', age: 6, species: 'ferret' });}
app.use(logger('dev'));
app.get('/', function(req, res){ res.render('pets', { pets: pets });});
/* istanbul ignore next */if (!module.parent) { app.listen(3000); console.log('Express started on port 3000');}deleted:examples/big-view/pets.jade-12 removed
1-style.2- body {3- padding: 50px;4- font: 16px "Helvetica Neue", Helvetica;5- }6-7-table8- for pet in pets9- tr10- td= pet.name11- td= pet.age12- td= pet.speciesmodified:examples/mvc/lib/boot.js+1 added
6 unmodified lines78910111213141563 unmodified lines6 unmodified lines
module.exports = function(parent, options){ var verbose = options.verbose; fs.readdirSync(__dirname + '/../controllers').forEach(function(name){ if (!fs.statSync(__dirname + '/../controllers/' + name).isDirectory()) return; verbose && console.log('\n %s:', name); var obj = require('./../controllers/' + name); var name = obj.name || name; var prefix = obj.prefix || '';63 unmodified linesmodified:examples/static-files/index.js+4 added-3 removed
2 unmodified lines345678910114 unmodified lines16171819192021222324252627272829303132333334353637383 unmodified lines2 unmodified lines */
var express = require('../..');var logger = require('morgan');var path = require('path');var app = express();
// log requestsapp.use(logger('dev'));4 unmodified lines// the `req.path` within the directory// that you pass it. In this case "GET /js/app.js"// will look for "./public/js/app.js".
app.use(express.static(__dirname + '/public'));app.use(express.static(path.join(__dirname, 'public')));
// if you wanted to "prefix" you may use// the mounting feature of Connect, for example// "GET /static/js/app.js" instead of "GET /js/app.js".// The mount-path "/static" is simply removed before// passing control to the express.static() middleware,// thus it serves the file correctly by ignoring "/static"app.use('/static', express.static(__dirname + '/public'));app.use('/static', express.static(path.join(__dirname, 'public')));
// if for some reason you want to serve files from// several directories, you can use express.static()// multiple times! Here we're passing "./public/css",// this will allow "GET /style.css" instead of "GET /css/style.css":app.use(express.static(__dirname + '/public/css'));app.use(express.static(path.join(__dirname, 'public', 'css')));
app.listen(3000);console.log('listening on port 3000');console.log('try:');3 unmodified linesmodified:test/app.options.js+1 added-1 removed
70 unmodified lines71 .expect('Allow', 'GET, HEAD')72 .expect(200, 'GET, HEAD', done);73 })74 75- describe('when error occurs in respone handler', function () {75+ describe('when error occurs in response handler', function () {76 it('should pass error to callback', function (done) {77 var app = express();78 var router = express.Router();79 36 unmodified linesmodified:test/app.router.js+1 added-1 removed
755 unmodified lines756 .get('/users/tj/edit')757 .expect('editing tj (old)', cb);758 })759 760- it('should work inside literal paranthesis', function(done){760+ it('should work inside literal parenthesis', function(done){761 var app = express();762 763 app.get('/:user\\(:op\\)', function(req, res){764 res.end(req.params.op + 'ing ' + req.params.user);270 unmodified linesmodified:test/req.acceptsEncodings.js+2 added-2 removed
2 unmodified lines3456778910116 unmodified lines1819202122222324252610 unmodified lines2 unmodified lines , request = require('supertest');
describe('req', function(){ describe('.acceptsEncodingss', function(){ it('should be true if encoding accpeted', function(done){ it('should be true if encoding accepted', function(done){ var app = express();
app.use(function(req, res){ req.acceptsEncodings('gzip').should.be.ok;6 unmodified lines .set('Accept-Encoding', ' gzip, deflate') .expect(200, done); })
it('should be false if encoding not accpeted', function(done){ it('should be false if encoding not accepted', function(done){ var app = express();
app.use(function(req, res){ req.acceptsEncodings('bogus').should.not.be.ok;10 unmodified linesmodified:test/req.acceptsLanguages.js+2 added-2 removed
2 unmodified lines3 , request = require('supertest');4 5 describe('req', function(){6 describe('.acceptsLanguages', function(){7- it('should be true if language accpeted', function(done){7+ it('should be true if language accepted', function(done){8 var app = express();9 10 app.use(function(req, res){11 req.acceptsLanguages('en-us').should.be.ok;6 unmodified lines18 .set('Accept-Language', 'en;q=.5, en-us')19 .expect(200, done);20 })21 22- it('should be false if language not accpeted', function(done){22+ it('should be false if language not accepted', function(done){23 var app = express();24 25 app.use(function(req, res){26 req.acceptsLanguages('es').should.not.be.ok;27 unmodified linesmodified:test/res.sendFile.js+20 added
114 unmodified lines115 var test = request(app).get('/');116 test.expect(200, cb);117 })118 119+ describe('with "cacheControl" option', function () {120+ it('should enable cacheControl by default', function (done) {121+ var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'))122+123+ request(app)124+ .get('/')125+ .expect('Cache-Control', 'public, max-age=0')126+ .expect(200, done)127+ })128+129+ it('should accept cacheControl option', function (done) {130+ var app = createApp(path.resolve(__dirname, 'fixtures/name.txt'), { cacheControl: false })131+132+ request(app)133+ .get('/')134+ .expect(utils.shouldNotHaveHeader('Cache-Control'))135+ .expect(200, done)136+ })137+ })138+139 describe('with "dotfiles" option', function () {140 it('should not serve dotfiles by default', function (done) {141 var app = createApp(path.resolve(__dirname, 'fixtures/.name'));142 184 unmodified linesmodified:.travis.yml+3 added-3 removed
3 unmodified lines4 - "0.12"5 - "1.8"6 - "2.5"7 - "3.3"8- - "4.4"9- - "5.11"10- - "6.2"8+ - "4.7"9+ - "5.12"10+ - "6.9"11 sudo: false12 cache:13 directories:14 - node_modules9 unmodified linesmodified:appveyor.yml+3 added-3 removed
3 unmodified lines4 - nodejs_version: "0.12"5 - nodejs_version: "1.8"6 - nodejs_version: "2.5"7 - nodejs_version: "3.3"8- - nodejs_version: "4.4"9- - nodejs_version: "5.11"10- - nodejs_version: "6.2"8+ - nodejs_version: "4.7"9+ - nodejs_version: "5.12"10+ - nodejs_version: "6.9"11 cache:12 - node_modules13 install:14 - ps: Install-Product node $env:nodejs_version10 unmodified linesmodified:Contributing.md+1 added-1 removed
29 unmodified lines30 31 Committers may direct you to another repository, ask for additional clarifications, and32 add appropriate metadata before the issue is addressed.33 34-Please be courteous, respectful, and every participant is expected to follow the 34+Please be courteous and respectful. Every participant is expected to follow the35 project's Code of Conduct.36 37 # Contributions38 54 unmodified linesmodified:History.md+21 added-1 removed
1 5.x2 ===3 4-This incorporates all changes after 4.13.1 up to 4.14.0.4+This incorporates all changes after 4.13.1 up to 4.14.1.5 6 * remove:7 - `res.json(status, obj)` signature - use `res.status(status).json(obj)`8 - `res.jsonp(status, obj)` signature - use `res.status(status).jsonp(obj)`35 unmodified lines44 - `req.query` is now a getter instead of a plain property45 * add:46 - `app.router` is a reference to the base router47 48+4.14.1 / 2017-01-2849+===================50+51+ * deps: content-disposition@0.5.252+ * deps: finalhandler@0.5.153+ - Fix exception when `err.headers` is not an object54+ - deps: statuses@~1.3.155+ - perf: hoist regular expressions56+ - perf: remove duplicate validation path57+ * deps: proxy-addr@~1.1.358+ - deps: ipaddr.js@1.2.059+ * deps: send@0.14.260+ - deps: http-errors@~1.5.161+ - deps: ms@0.7.262+ - deps: statuses@~1.3.163+ * deps: serve-static@~1.11.264+ - deps: send@0.14.265+ * deps: type-is@~1.6.1466+ - deps: mime-types@~2.1.1367+68 4.14.0 / 2016-06-1669 ===================70 71 * Add `acceptRanges` option to `res.sendFile`/`res.sendfile`3138 unmodified linesmodified:package.json+15 added-15 removed
27 unmodified lines28 ],29 "dependencies": {30 "accepts": "~1.3.3",31 "array-flatten": "2.0.0",32- "content-disposition": "0.5.1",32+ "content-disposition": "0.5.2",33 "content-type": "~1.0.2",34 "cookie": "0.3.1",35 "cookie-signature": "1.0.6",36 "debug": "~2.2.0",37 "depd": "~1.1.0",38 "encodeurl": "~1.0.1",39 "escape-html": "~1.0.3",40 "etag": "~1.7.0",41- "finalhandler": "0.5.0",41+ "finalhandler": "0.5.1",42 "fresh": "0.3.0",43 "merge-descriptors": "1.0.1",44 "methods": "~1.1.2",45 "on-finished": "~2.3.0",46 "parseurl": "~1.3.1",47 "path-is-absolute": "1.0.0",48 "path-to-regexp": "0.1.7",49- "proxy-addr": "~1.1.2",49+ "proxy-addr": "~1.1.3",50 "qs": "6.2.0",51 "range-parser": "~1.2.0",52 "router": "~1.1.3",53- "send": "0.14.1",54- "serve-static": "~1.11.1",55- "type-is": "~1.6.13",53+ "send": "0.14.2",54+ "serve-static": "~1.11.2",55+ "type-is": "~1.6.14",56 "utils-merge": "1.0.0",57 "vary": "~1.1.0"58 },59 "devDependencies": {60- "after": "0.8.1",61- "body-parser": "~1.15.1",60+ "after": "0.8.2",61+ "body-parser": "1.16.0",62 "cookie-parser": "~1.4.3",63- "ejs": "2.4.2",64- "istanbul": "0.4.3",65- "marked": "0.3.5",63+ "ejs": "2.5.5",64+ "express-session": "1.15.0",65+ "istanbul": "0.4.5",66+ "marked": "0.3.6",67 "method-override": "~2.3.6",67- "mocha": "2.5.3",68+ "mocha": "3.2.0",69 "morgan": "~1.7.0",70+ "multiparty": "4.1.3",69- "should": "9.0.2",71+ "should": "11.2.0",72 "supertest": "1.2.0",73 "connect-redis": "~2.4.1",74 "cookie-session": "~1.2.0",73- "express-session": "~1.13.0",75 "jade": "~1.11.0",75- "multiparty": "~4.1.2",76 "vhost": "~3.0.2"77 },78 "engines": {79 "node": ">= 0.10.0"15 unmodified linesmodified:Security.md-1 removed
3 unmodified lines4 project.5 6 * [Reporting a Bug](#reporting-a-bug)7 * [Disclosure Policy](#disclosure-policy)8- * [Receiving Security Updates](#receiving-security-updates)8 * [Comments on this Policy](#comments-on-this-policy)9 10 ## Reporting a Bug11 32 unmodified lines