Skip to content
Myr

Merge tag '4.14.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 8a387d3, 9375a9a · Browse files · 28 files+517 added−195 removed
This commit

State

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

Diff stats

28 files+517 added−195 removed

  • tests:+200 added−119 removed
  • other:+317 added−76 removed

28 files+517 added−195 removed

modified:examples/error/index.js+3 added
modified:examples/markdown/index.js+6 added-10 removed
modified:examples/view-locals/user.js+3 added
modified:lib/request.js+31 added-18 removed
54 unmodified lines
55 */5657req.get =58req.header = function header(name) {59 if (!name) {60 throw new TypeError('name argument is required to req.get');61 }6263 if (typeof name !== 'string') {64 throw new TypeError('name must be a string to req.get');65 }6667 var lc = name.toLowerCase();6869 switch (lc) {70 case 'referer':
97 unmodified lines
168 return accept.languages.apply(accept, arguments);169};170171/**164 * Parse Range header field,165 * capping to the given `size`.172 * Parse Range header field, capping to the given `size`.173 *167 * Unspecified ranges such as "0-" require168 * knowledge of your resource length. In169 * the case of a byte range this is of course170 * the total number of bytes. If the Range171 * header field is not given `null` is returned,172 * `-1` when unsatisfiable, `-2` when syntactically invalid.174 * Unspecified ranges such as "0-" require knowledge of your resource length. In175 * the case of a byte range this is of course the total number of bytes. If the176 * Range header field is not given `undefined` is returned, `-1` when unsatisfiable,177 * and `-2` when syntactically invalid.178 *174 * NOTE: remember that ranges are inclusive, so175 * for example "Range: users=0-3" should respond176 * with 4 users when available, not 3.179 * When ranges are returned, the array has a "type" property which is the type of180 * range that is required (most commonly, "bytes"). Each array element is an object181 * with a "start" and "end" property for the portion of the range.182 *178 * @param {Number} size179 * @return {Array}183 * The "combine" option can be set to `true` and overlapping & adjacent ranges184 * will be combined into a single range.185 *186 * NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"187 * should respond with 4 users when available, not 3.188 *189 * @param {number} size190 * @param {object} [options]191 * @param {boolean} [options.combine=false]192 * @return {number|array}193 * @public194 */195183req.range = function(size){196req.range = function range(size, options) {197 var range = this.get('Range');198 if (!range) return;186 return parseRange(size, range);199 return parseRange(size, range, options);200};201202/**203 * Parse the query string of `req.url`.
90 unmodified lines
294295/**296 * Short-hand for:297 *285 * req.protocol == 'https'298 * req.protocol === 'https'299 *300 * @return {Boolean}301 * @public302 */
136 unmodified lines
439 var method = this.method;440 var s = this.res.statusCode;441442 // GET or HEAD for weak freshness validation only430 if ('GET' != method && 'HEAD' != method) return false;443 if ('GET' !== method && 'HEAD' !== method) return false;444445 // 2xx or 304 as per rfc2616 14.26433 if ((s >= 200 && s < 300) || 304 == s) {446 if ((s >= 200 && s < 300) || 304 === s) {447 return fresh(this.headers, (this.res._headers || {}));448 }449450 return false;
42 unmodified lines
modified:lib/response.js+21 added-9 removed
12 unmodified lines
13 */1415var contentDisposition = require('content-disposition');16var deprecate = require('depd')('express');17var encodeUrl = require('encodeurl');18var escapeHtml = require('escape-html');19var http = require('http');20var onFinished = require('on-finished');21var path = require('path');
149 unmodified lines
171 // freshness172 if (req.fresh) this.statusCode = 304;173174 // strip irrelevant headers174 if (204 == this.statusCode || 304 == this.statusCode) {175 if (204 === this.statusCode || 304 === this.statusCode) {176 this.removeHeader('Content-Type');177 this.removeHeader('Content-Length');178 this.removeHeader('Transfer-Encoding');179 chunk = '';
35 unmodified lines
215 // settings216 var app = this.app;217 var replacer = app.get('json replacer');218 var spaces = app.get('json spaces');218 var body = JSON.stringify(val, replacer, spaces);219 var body = stringify(val, replacer, spaces);220221 // content-type222 if (!this.get('Content-Type')) {223 this.set('Content-Type', 'application/json');
27 unmodified lines
251 // settings252 var app = this.app;253 var replacer = app.get('json replacer');254 var spaces = app.get('json spaces');254 var body = JSON.stringify(val, replacer, spaces);255 var body = stringify(val, replacer, spaces);256 var callback = this.req.query[app.get('jsonp callback name')];257258 // content-type259 if (!this.get('Content-Type')) {
378 unmodified lines
638/**639 * Clear cookie `name`.640 *641 * @param {String} name641 * @param {Object} options642 * @param {Object} [options]643 * @return {ServerResponse} for chaining644 * @public645 */646
83 unmodified lines
730 loc = this.req.get('Referrer') || '/';731 }732733 // set location733 this.set('Location', loc);734 return this;734 return this.set('Location', encodeUrl(loc));735};736737/**738 * Redirect to the given `url` with optional response `status`
29 unmodified lines
768 }769 }770771 // Set location header772 this.location(address);773 address = this.get('Location');772 address = this.location(address).get('Location');773774 // Support text/{plain,html} by default775 this.format({776 text: function(){778 body = statusCodes[status] + '. Redirecting to ' + encodeURI(address);777 body = statusCodes[status] + '. Redirecting to ' + address;778 },779780 html: function(){781 var u = escapeHtml(address);
165 unmodified lines
947948 // pipe949 file.pipe(res);950}951952/**953 * Stringify JSON, like JSON.stringify, but v8 optimized.954 * @private955 */956957function stringify(value, replacer, spaces) {958 // v8 checks arguments.length for optimizing simple call959 // https://bugs.chromium.org/p/v8/issues/detail?id=4730960 return replacer || spaces961 ? JSON.stringify(value, replacer, spaces)962 : JSON.stringify(value);963}
modified:lib/utils.js+1 added-2 removed
100 unmodified lines
101 var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index };102103 for (var i = 1; i < parts.length; ++i) {104 var pms = parts[i].split(/ *= */);105 if ('q' == pms[0]) {105 if ('q' === pms[0]) {106 ret.quality = parseFloat(pms[1]);107 } else {108 ret.params[pms[0]] = pms[1];109 }
131 unmodified lines
241 */242243function parseExtendedQueryString(str) {244 return qs.parse(str, {245 allowDots: false,245 allowPrototypes: true246 });247}
modified:test/acceptance/cookies.js+7 added-12 removed
12var app = require('../../examples/cookies')3 , request = require('supertest');4var utils = require('../support/utils');56describe('cookies', function(){7 describe('GET /', function(){8 it('should have a form', function(done){
4 unmodified lines
1314 it('should respond with no cookies', function(done){15 request(app)16 .get('/')16 .end(function(err, res){17 res.headers.should.not.have.property('set-cookie')18 done()19 })17 .expect(utils.shouldNotHaveHeader('Set-Cookie'))18 .expect(200, done)19 })2021 it('should respond to cookie', function(done){22 request(app)
32 unmodified lines
55 request(app)56 .post('/')57 .type('urlencoded')58 .send({ remember: 1 })60 .expect(302, function(err, res){61 res.headers.should.have.property('set-cookie')62 done()63 })59 .expect('Set-Cookie', /remember=1/)60 .expect(302, done)61 })6263 it('should no set cookie w/o reminder', function(done){64 request(app)65 .post('/')66 .send({})70 .expect(302, function(err, res){71 res.headers.should.not.have.property('set-cookie')72 done()73 })67 .expect(utils.shouldNotHaveHeader('Set-Cookie'))68 .expect(302, done)69 })70 })71})
modified:test/acceptance/downloads.js+2 added-5 removed
added:test/support/utils.js+24 added
12/**3 * Module dependencies.4 * @private5 */6var assert = require('assert');78/**9 * Module exports.10 * @public11 */12exports.shouldNotHaveHeader = shouldNotHaveHeader;1314/**15 * Assert that a supertest response does not have a header.16 *17 * @param {string} header Header name to check18 * @returns {function}19 */20function shouldNotHaveHeader(header) {21 return function (res) {22 assert.ok(!(header.toLowerCase() in res.headers), 'should not have header ' + header);23 };24}
modified:test/middleware.basic.js+2 added-7 removed
30 unmodified lines
31 request(app.listen())32 .get('/')33 .set('Content-Type', 'application/json')34 .send('{"foo":"bar"}')35 .end(function(err, res){36 if (err) return done(err);37 res.headers.should.have.property('content-type', 'application/json');38 res.statusCode.should.equal(200);39 res.text.should.equal('{"foo":"bar"}');40 done();41 })35 .expect('Content-Type', 'application/json')36 .expect(200, '{"foo":"bar"}', done)37 })38 })39})
modified:test/req.get.js+25 added-1 removed
29 unmodified lines
30 .post('/')31 .set('Referrer', 'http://foobar.com')32 .expect('http://foobar.com', done);33 })3435 it('should throw missing header name', function (done) {36 var app = express()3738 app.use(function (req, res) {39 res.end(req.get())40 })4142 request(app)43 .get('/')44 .expect(500, /TypeError: name argument is required to req.get/, done)45 })4647 it('should throw for non-string header name', function (done) {48 var app = express()4950 app.use(function (req, res) {51 res.end(req.get(42))52 })5354 request(app)55 .get('/')56 .expect(500, /TypeError: name must be a string to req.get/, done)57 })58 })35})59})
modified:test/req.query.js+4 added-4 removed
41 unmodified lines
42 it('should not parse complex keys', function (done) {43 var app = createApp('simple');4445 request(app)46 .get('/?user[name]=tj')46 .get('/?user%5Bname%5D=tj')47 .expect(200, '{"user[name]":"tj"}', done);48 });49 });50
3 unmodified lines
54 return {'length': (str || '').length};55 });5657 request(app)58 .get('/?user[name]=tj')58 .get('/?user%5Bname%5D=tj')59 .expect(200, '{"length":17}', done);60 });61 });62
1 unmodified line
64 it('should not parse query', function (done) {65 var app = createApp(false);6667 request(app)68 .get('/?user[name]=tj')68 .get('/?user%5Bname%5D=tj')69 .expect(200, '{}', done);70 });71 });72
1 unmodified line
74 it('should not parse complex keys', function (done) {75 var app = createApp(true);7677 request(app)78 .get('/?user[name]=tj')78 .get('/?user%5Bname%5D=tj')79 .expect(200, '{"user[name]":"tj"}', done);80 });81 });82
21 unmodified lines
modified:test/req.range.js+13 added-3 removed
10 unmodified lines
1112describe('req', function(){13 describe('.range(size)', function(){14 it('should return parsed ranges', function(){15 var ret = [{ start: 0, end: 50 }, { start: 60, end: 100 }];16 ret.type = 'bytes';17 req('bytes=0-50,60-100').range(120).should.eql(ret);15 var ranges = [{ start: 0, end: 50 }, { start: 51, end: 100 }]16 ranges.type = 'bytes'17 assert.deepEqual(req('bytes=0-50,51-100').range(120), ranges)18 })1920 it('should cap to the given size', function(){21 var ret = [{ start: 0, end: 74 }];
12 unmodified lines
34 ret.type = 'bytes';35 assert(req('').range(120) === undefined);36 })37 })3839 describe('.range(size, options)', function(){40 describe('with "combine: true" option', function(){41 it('should return combined ranges', function(){42 var ranges = [{ start: 0, end: 100 }]43 ranges.type = 'bytes'44 assert.deepEqual(req('bytes=0-50,51-100').range(120, { combine: true }), ranges)45 })46 })47 })48})
modified:test/res.cookie.js+16 added
148 unmodified lines
149 })150 })151 })152153 describe('signed without secret', function(){154 it('should throw an error', function(done){155 var app = express();156157 app.use(cookieParser());158159 app.use(function(req, res){160 res.cookie('name', 'tobi', { signed: true }).end();161 });162163 request(app)164 .get('/')165 .expect(500, /secret\S+ required for signed cookies/, done);166 })167 })168169 describe('.signedCookie(name, string)', function(){170 it('should set a signed cookie', function(done){171 var app = express();172
17 unmodified lines
modified:test/res.jsonp.js+3 added-5 removed
12var express = require('../')3 , request = require('supertest')4 , assert = require('assert');5var utils = require('./support/utils');67describe('res', function(){8 describe('.jsonp(object)', function(){9 it('should respond with jsonp', function(done){
126 unmodified lines
136137 request(app)138 .get('/')139 .expect('Content-Type', 'application/vnd.example+json; charset=utf-8')139 .expect(200, '{"hello":"world"}', function (err, res) {140 if (err) return done(err);141 res.headers.should.not.have.property('x-content-type-options');142 done();143 });140 .expect(utils.shouldNotHaveHeader('X-Content-Type-Options'))141 .expect(200, '{"hello":"world"}', done);142 })143144 it('should override previous Content-Types with callback', function(done){145 var app = express();
172 unmodified lines
modified:test/res.location.js+27 added-3 removed
11 unmodified lines
12 });1314 request(app)15 .get('/')16 .end(function(err, res){17 res.headers.should.have.property('location', 'http://google.com');18 done();16 .expect('Location', 'http://google.com')17 .expect(200, done)18 })1920 it('should encode "url"', function (done) {21 var app = express()2223 app.use(function (req, res) {24 res.location('https://google.com?q=\u2603 §10').end()25 })2627 request(app)28 .get('/')29 .expect('Location', 'https://google.com?q=%E2%98%83%20%C2%A710')30 .expect(200, done)31 })3233 it('should not touch already-encoded sequences in "url"', function (done) {34 var app = express()3536 app.use(function (req, res) {37 res.location('https://google.com?q=%A710').end()38 })3940 request(app)41 .get('/')42 .expect('Location', 'https://google.com?q=%A710')43 .expect(200, done)44 })45 })46})
modified:test/res.redirect.js+40 added-25 removed
12var http = require('http');3var express = require('..');4var request = require('supertest');5var utils = require('./support/utils');67describe('res', function(){8 describe('.redirect(url)', function(){9 it('should default to a 302 redirect', function(done){
7 unmodified lines
17 .get('/')18 .expect('location', 'http://google.com')19 .expect(302, done)20 })2122 it('should encode "url"', function (done) {23 var app = express()2425 app.use(function (req, res) {26 res.redirect('https://google.com?q=\u2603 §10')27 })2829 request(app)30 .get('/')31 .expect('Location', 'https://google.com?q=%E2%98%83%20%C2%A710')32 .expect(302, done)33 })3435 it('should not touch already-encoded sequences in "url"', function (done) {36 var app = express()3738 app.use(function (req, res) {39 res.redirect('https://google.com?q=%A710')40 })4142 request(app)43 .get('/')44 .expect('Location', 'https://google.com?q=%A710')45 .expect(302, done)46 })47 })4849 describe('.redirect(status, url)', function(){50 it('should set the response status', function(done){
4 unmodified lines
55 });5657 request(app)58 .get('/')32 .end(function(err, res){33 res.statusCode.should.equal(303);34 res.headers.should.have.property('location', 'http://google.com');35 done();36 })59 .expect('Location', 'http://google.com')60 .expect(303, done)61 })62 })6364 describe('.redirect(url, status)', function(){
5 unmodified lines
70 });7172 request(app)73 .get('/')50 .end(function(err, res){51 res.statusCode.should.equal(303);52 res.headers.should.have.property('location', 'http://google.com');53 done();54 })74 .expect('Location', 'http://google.com')75 .expect(303, done)76 })77 })7879 describe('when the request method is HEAD', function(){
5 unmodified lines
85 });8687 request(app)88 .head('/')68 .end(function(err, res){69 res.headers.should.have.property('location', 'http://google.com');70 res.text.should.equal('');71 done();72 })89 .expect('Location', 'http://google.com')90 .expect(302, '', done)91 })92 })9394 describe('when accepting html', function(){
15 unmodified lines
110 it('should escape the url', function(done){111 var app = express();112113 app.use(function(req, res){96 res.redirect('<lame>');114 res.redirect('<la\'me>');115 });116117 request(app)118 .get('/')119 .set('Host', 'http://example.com')120 .set('Accept', 'text/html')121 .expect('Content-Type', /html/)104 .expect('Location', '<lame>')105 .expect(302, '<p>' + http.STATUS_CODES[302] + '. Redirecting to <a href="&lt;lame&gt;">&lt;lame&gt;</a></p>', done);122 .expect('Location', '%3Cla\'me%3E')123 .expect(302, '<p>' + http.STATUS_CODES[302] + '. Redirecting to <a href="%3Cla&#39;me%3E">%3Cla&#39;me%3E</a></p>', done)124 })125126 it('should include the redirect type', function(done){127 var app = express();
38 unmodified lines
166 .get('/')167 .set('Host', 'http://example.com')168 .set('Accept', 'text/plain, */*')169 .expect('Content-Type', /plain/)152 .expect('Location', 'http://example.com/?param=<script>alert("hax");</script>')153 .expect(302, http.STATUS_CODES[302] + '. Redirecting to http://example.com/?param=%3Cscript%3Ealert(%22hax%22);%3C/script%3E', done);170 .expect('Location', 'http://example.com/?param=%3Cscript%3Ealert(%22hax%22);%3C/script%3E')171 .expect(302, http.STATUS_CODES[302] + '. Redirecting to http://example.com/?param=%3Cscript%3Ealert(%22hax%22);%3C/script%3E', done)172 })173174 it('should include the redirect type', function(done){175 var app = express();
23 unmodified lines
199 .get('/')200 .set('Accept', 'application/octet-stream')201 .expect('location', 'http://google.com')202 .expect('content-length', '0')185 .expect(302, '', function(err, res){186 if (err) return done(err)187 res.headers.should.not.have.property('content-type');188 done();189 })203 .expect(utils.shouldNotHaveHeader('Content-Type'))204 .expect(302, '', done)205 })206 })207})
modified:test/res.send.js+18 added-41 removed
1 unmodified line
2var assert = require('assert');3var express = require('..');4var methods = require('methods');5var request = require('supertest');6var utils = require('./support/utils');78describe('res', function(){9 describe('.send()', function(){10 it('should set body to ""', function(done){
92 unmodified lines
103 });104105 request(app)106 .get('/')106 .end(function(err, res){107 res.headers.should.have.property('content-type', 'text/html; charset=utf-8');108 res.text.should.equal('<p>hey</p>');109 res.statusCode.should.equal(200);110 done();111 })107 .expect('Content-Type', 'text/html; charset=utf-8')108 .expect(200, '<p>hey</p>', done);109 })110111 it('should set ETag', function (done) {112 var app = express();
58 unmodified lines
171 });172173 request(app)174 .get('/')178 .end(function(err, res){179 res.headers.should.have.property('content-type', 'application/octet-stream');180 res.text.should.equal('hello');181 res.statusCode.should.equal(200);182 done();183 })175 .expect('Content-Type', 'application/octet-stream')176 .expect(200, 'hello', done);177 })178179 it('should set ETag', function (done) {180 var app = express();
17 unmodified lines
198 });199200 request(app)201 .get('/')209 .end(function(err, res){210 res.headers.should.have.property('content-type', 'text/plain; charset=utf-8');211 res.text.should.equal('hey');212 res.statusCode.should.equal(200);213 done();214 })202 .expect('Content-Type', 'text/plain; charset=utf-8')203 .expect(200, 'hey', done);204 })205 })206207 describe('.send(Object)', function(){
34 unmodified lines
242 });243244 request(app)245 .get('/')257 .end(function(err, res){258 res.headers.should.not.have.property('content-type');259 res.headers.should.not.have.property('content-length');260 res.headers.should.not.have.property('transfer-encoding');261 res.text.should.equal('');262 done();263 })246 .expect(utils.shouldNotHaveHeader('Content-Type'))247 .expect(utils.shouldNotHaveHeader('Content-Length'))248 .expect(utils.shouldNotHaveHeader('Transfer-Encoding'))249 .expect(204, '', done);250 })251 })252253 describe('when .statusCode is 304', function(){
5 unmodified lines
259 });260261 request(app)262 .get('/')277 .end(function(err, res){278 res.headers.should.not.have.property('content-type');279 res.headers.should.not.have.property('content-length');280 res.headers.should.not.have.property('transfer-encoding');281 res.text.should.equal('');282 done();283 })263 .expect(utils.shouldNotHaveHeader('Content-Type'))264 .expect(utils.shouldNotHaveHeader('Content-Length'))265 .expect(utils.shouldNotHaveHeader('Transfer-Encoding'))266 .expect(304, '', done);267 })268 })269270 it('should always check regardless of length', function(done){
147 unmodified lines
418 app.enable('etag');419420 request(app)421 .get('/')439 .expect(shouldNotHaveHeader('ETag'))422 .expect(utils.shouldNotHaveHeader('ETag'))423 .expect(200, done);424 })425 });426
9 unmodified lines
436 app.disable('etag');437438 request(app)439 .get('/')457 .expect(shouldNotHaveHeader('ETag'))440 .expect(utils.shouldNotHaveHeader('ETag'))441 .expect(200, done);442 });443444 it('should send ETag when manually set', function (done) {
81 unmodified lines
526 });527528 request(app)529 .get('/')547 .expect(shouldNotHaveHeader('ETag'))530 .expect(utils.shouldNotHaveHeader('ETag'))531 .expect(200, done);532 })533 })534 })535})553554function shouldNotHaveHeader(header) {555 return function (res) {556 assert.ok(!(header.toLowerCase() in res.headers), 'should not have header ' + header)557 }558}
modified:test/res.sendFile.js+11 added-5 removed
5 unmodified lines
6var onFinished = require('on-finished');7var path = require('path');8var should = require('should');9var fixtures = path.join(__dirname, 'fixtures');10var utils = require('./support/utils');1112describe('res', function(){13 describe('.sendFile(path)', function () {14 it('should error missing path', function (done) {
139 unmodified lines
154 var app = createApp(path.resolve(__dirname, 'fixtures/does-not-exist'), { headers: headers });155156 request(app)157 .get('/')157 .expect(404, function (err, res) {158 if (err) return done(err);159 res.headers.should.not.have.property('x-success');160 done();161 });158 .expect(utils.shouldNotHaveHeader('X-Success'))159 .expect(404, done);160 });161 });162163 describe('with "root" option', function () {
120 unmodified lines
284 .get('/')285 .expect(200, 'got it', done);286 })287 })288289 describe('.sendFile(path, options)', function () {290 it('should pass options to send module', function (done) {291 request(createApp(path.resolve(fixtures, 'name.txt'), { start: 0, end: 1 }))292 .get('/')293 .expect(200, 'to', done)294 })295 })296})297298function createApp(path, options, fn) {299 var app = express();
7 unmodified lines
modified:test/res.vary.js+3 added-8 removed
12var assert = require('assert');3var express = require('..');4var request = require('supertest');5var utils = require('./support/utils');67describe('res.vary()', function(){8 describe('with no arguments', function(){9 it('should not set Vary', function (done) {
5 unmodified lines
15 });1617 request(app)18 .get('/')18 .expect(shouldNotHaveHeader('Vary'))19 .expect(utils.shouldNotHaveHeader('Vary'))20 .expect(200, done);21 })22 })23
7 unmodified lines
31 });3233 request(app)34 .get('/')34 .expect(shouldNotHaveHeader('Vary'))35 .expect(utils.shouldNotHaveHeader('Vary'))36 .expect(200, done);37 })38 })39
48 unmodified lines
88 .expect(200, done);89 })90 })91})9192function shouldNotHaveHeader(header) {93 return function (res) {94 assert.ok(!(header.toLowerCase() in res.headers), 'should not have header ' + header);95 };96}
modified:test/Route.js+5 added
5 unmodified lines
6 , methods = require('methods')7 , assert = require('assert');89describe('Route', function(){10 it('should work without handlers', function(done) {11 var req = { method: 'GET', url: '/' }12 var route = new Route('/foo')13 route.dispatch(req, {}, done)14 })1516 describe('.all', function(){17 it('should add handler', function(done){18 var req = { method: 'GET', url: '/' };
225 unmodified lines
modified:.travis.yml+13 added-2 removed
3 unmodified lines
4 - "0.12"5 - "1.8"6 - "2.5"7 - "3.3"8 - "4.2"8 - "4.4"9 - "5.11"10 - "6.2"11sudo: false12cache:13 directories:14 - node_modules15before_install:16 # Remove all non-test dependencies10before_install: "npm rm --save-dev connect-redis"17 - "npm rm --save-dev connect-redis"1819 # Update Node.js modules20 - "test ! -d node_modules || npm prune"21 - "test ! -d node_modules || npm rebuild"22script: "npm run-script test-ci"23after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
modified:appveyor.yml+7 added-1 removed
3 unmodified lines
4 - nodejs_version: "0.12"5 - nodejs_version: "1.8"6 - nodejs_version: "2.5"7 - nodejs_version: "3.3"8 - nodejs_version: "4.2"8 - nodejs_version: "4.4"9 - nodejs_version: "5.11"10 - nodejs_version: "6.2"11cache:12 - node_modules13install:14 - ps: Install-Product node $env:nodejs_version15 - npm rm --save-dev connect-redis16 - if exist node_modules npm prune17 - if exist node_modules npm rebuild18 - npm install19build: off20test_script:21 - node --version
3 unmodified lines
added:Collaborator-Guide.md+36 added
12## Website Issues34Open issues for the expressjs.com website in https://github.com/expressjs/expressjs.com.56## PRs and Code contributions78* Tests must pass.9* Follow existing coding style.10* If you fix a bug, add a test.1112## Branches1314* Use the `master` branch for bug fixes or minor work that is intended for the current release stream15* Use the correspondingly named branch, e.g. `5.0`, for anything intended for a future release of Express 1617## Steps for contributing1819* [Create an issue](https://github.com/expressjs/express/issues/new) for the bug you want to fix or the feature that you want to add.20* Create your own [fork](https://github.com/expressjs/express) on github, then checkout your fork.21* Write your code in your local copy. It's good practice to create a branch for each new issue you work on, although not compulsory.22* To run the test suite, first install the dependencies by running `npm install`, then run `npm test`.23* If the tests pass, you can commit your changes to your fork and then create a pull request from there. Make sure to reference your issue from the pull request comments by including the issue number e.g. #123.2425## Issues which are questions2627We will typically close any vague issues or questions that are specific to some app you are writing. Please double check the docs and other references before being trigger happy with posting a question issue.2829Things that will help get your question issue looked at:3031* Full and runnable JS code.32* Clear description of the problem or unexpected behavior.33* Clear description of the expected result.34* Steps you have taken to debug it yourself.3536If you post a question and do not outline the above items or make it easy for us to understand and reproduce your issue, it will be closed.
modified:Contributing.md+84 added-13 removed
1# Contributing1# Node.js Community Contributing Guide 1.023## PRs and Code contributions3This document describes a very simple process suitable for most projects4in the Node.js ecosystem. Projects are encouraged to adopt this whether they5are hosted in the Node.js Foundation or not.65* Tests must pass.6* Follow existing coding style.7* If you fix a bug, add a test.7The goal of this document is to create a contribution process that:89* Encourages new contributions.10* Encourages contributors to remain involved.11* Avoids unnecessary processes and bureaucracy whenever possible.12* Creates a transparent decision making process which makes it clear how13contributors can be involved in decision making.1410## Issues which are questions15This document is based on much prior art in the Node.js community, io.js,16and the Node.js project.1712We will typically close any vague issues or questions that are specific to some app you are writing. Please double check the docs and other references before being trigger happy with posting a question issue.18## Vocabulary1914Things that will help get your question issue looked at:20* A **Contributor** is any individual creating or commenting on an issue or pull request.21* A **Committer** is a subset of contributors who have been given write access to the repository.22* A **TC (Technical Committee)** is a group of committers representing the required technical 23expertise to resolve rare disputes.2416* Full and runnable JS code.17* Clear description of the problem or unexpected behavior.18* Clear description of the expected result.19* Steps you have taken to debug it yourself.25# Logging Issues2621If you post a question and do not outline the above items or make it easy for us to understand and reproduce your issue, it will be closed.27Log an issue for any question or problem you might have. When in doubt, log an issue, 28any additional policies about what to include will be provided in the responses. The only29exception is security dislosures which should be sent privately.3031Committers may direct you to another repository, ask for additional clarifications, and32add appropriate metadata before the issue is addressed.3334Please be courteous, respectful, and every participant is expected to follow the 35project's Code of Conduct.3637# Contributions3839Any change to resources in this repository must be through pull requests. This applies to all changes40to documentation, code, binary files, etc. Even long term committers and TC members must use41pull requests.4243No pull request can be merged without being reviewed.4445For non-trivial contributions, pull requests should sit for at least 36 hours to ensure that46contributors in other timezones have time to review. Consideration should also be given to 47weekends and other holiday periods to ensure active committers all have reasonable time to 48become involved in the discussion and review process if they wish.4950The default for each contribution is that it is accepted once no committer has an objection.51During review committers may also request that a specific contributor who is most versed in a 52particular area gives a "LGTM" before the PR can be merged. There is no additional "sign off" 53process for contributions to land. Once all issues brought by committers are addressed it can 54be landed by any committer.5556In the case of an objection being raised in a pull request by another committer, all involved 57committers should seek to arrive at a consensus by way of addressing concerns being expressed 58by discussion, compromise on the proposed change, or withdrawal of the proposed change.5960If a contribution is controversial and committers cannot agree about how to get it to land61or if it should land then it should be escalated to the TC. TC members should regularly62discuss pending contributions in order to find a resolution. It is expected that only a 63small minority of issues be brought to the TC for resolution and that discussion and 64compromise among committers be the default resolution mechanism.6566# Becoming a Committer6768All contributors who land a non-trivial contribution should be on-boarded in a timely manner,69and added as a committer, and be given write access to the repository.7071Committers are expected to follow this policy and continue to send pull requests, go through72proper review, and have other committers merge their pull requests.7374# TC Process7576The TC uses a "consensus seeking" process for issues that are escalated to the TC. 77The group tries to find a resolution that has no open objections among TC members.78If a consensus cannot be reached that has no objections then a majority wins vote79is called. It is also expected that the majority of decisions made by the TC are via 80a consensus seeking process and that voting is only used as a last-resort.8182Resolution may involve returning the issue to committers with suggestions on how to 83move forward towards a consensus. It is not expected that a meeting of the TC 84will resolve all issues on its agenda during that meeting and may prefer to continue85the discussion happening among the committers.8687Members can be added to the TC at any time. Any committer can nominate another committer88to the TC and the TC uses its standard consensus seeking process to evaluate whether or89not to add this new member. Members who do not participate consistently at the level of 90a majority of the other members are expected to resign.9192
modified:History.md+85 added
15.x2===34This incorporates all changes after 4.13.1 up to 4.14.0.565.0.0-alpha.2 / 2015-07-067==========================89This is the second Express 5.0 alpha release, based off 4.13.1 and includes
29 unmodified lines
39 - `req.query` is now a getter instead of a plain property40 * add:41 - `app.router` is a reference to the base router42434.14.0 / 2016-06-1644===================4546 * Add `acceptRanges` option to `res.sendFile`/`res.sendfile`47 * Add `cacheControl` option to `res.sendFile`/`res.sendfile`48 * Add `options` argument to `req.range`49 - Includes the `combine` option50 * Encode URL in `res.location`/`res.redirect` if not already encoded51 * Fix some redirect handling in `res.sendFile`/`res.sendfile`52 * Fix Windows absolute path check using forward slashes53 * Improve error with invalid arguments to `req.get()`54 * Improve performance for `res.json`/`res.jsonp` in most cases55 * Improve `Range` header handling in `res.sendFile`/`res.sendfile`56 * deps: accepts@~1.3.357 - Fix including type extensions in parameters in `Accept` parsing58 - Fix parsing `Accept` parameters with quoted equals59 - Fix parsing `Accept` parameters with quoted semicolons60 - Many performance improvments61 - deps: mime-types@~2.1.1162 - deps: negotiator@0.6.163 * deps: content-type@~1.0.264 - perf: enable strict mode65 * deps: cookie@0.3.166 - Add `sameSite` option67 - Fix cookie `Max-Age` to never be a floating point number68 - Improve error message when `encode` is not a function69 - Improve error message when `expires` is not a `Date`70 - Throw better error for invalid argument to parse71 - Throw on invalid values provided to `serialize`72 - perf: enable strict mode73 - perf: hoist regular expression74 - perf: use for loop in parse75 - perf: use string concatination for serialization76 * deps: finalhandler@0.5.077 - Change invalid or non-numeric status code to 50078 - Overwrite status message to match set status code79 - Prefer `err.statusCode` if `err.status` is invalid80 - Set response headers from `err.headers` object81 - Use `statuses` instead of `http` module for status messages82 * deps: proxy-addr@~1.1.283 - Fix accepting various invalid netmasks84 - Fix IPv6-mapped IPv4 validation edge cases85 - IPv4 netmasks must be contingous86 - IPv6 addresses cannot be used as a netmask87 - deps: ipaddr.js@1.1.188 * deps: qs@6.2.089 - Add `decoder` option in `parse` function90 * deps: range-parser@~1.2.091 - Add `combine` option to combine overlapping ranges92 - Fix incorrectly returning -1 when there is at least one valid range93 - perf: remove internal function94 * deps: send@0.14.195 - Add `acceptRanges` option96 - Add `cacheControl` option97 - Attempt to combine multiple ranges into single range98 - Correctly inherit from `Stream` class99 - Fix `Content-Range` header in 416 responses when using `start`/`end` options100 - Fix `Content-Range` header missing from default 416 responses101 - Fix redirect error when `path` contains raw non-URL characters102 - Fix redirect when `path` starts with multiple forward slashes103 - Ignore non-byte `Range` headers104 - deps: http-errors@~1.5.0105 - deps: range-parser@~1.2.0106 - deps: statuses@~1.3.0107 - perf: remove argument reassignment108 * deps: serve-static@~1.11.1109 - Add `acceptRanges` option110 - Add `cacheControl` option111 - Attempt to combine multiple ranges into single range112 - Fix redirect error when `req.url` contains raw non-URL characters113 - Ignore non-byte `Range` headers114 - Use status code 301 for redirects115 - deps: send@0.14.1116 * deps: type-is@~1.6.13117 - Fix type error when given invalid type to match against118 - deps: mime-types@~2.1.11119 * deps: vary@~1.1.0120 - Only accept valid field names in the `field` argument121 * perf: use strict equality when possible1221234.13.4 / 2016-01-21124===================125126 * deps: content-disposition@0.5.1
3058 unmodified lines
modified:package.json+23 added-21 removed
12 unmodified lines
13 "Young Jae Sim <hanul@hanul.me>"14 ],15 "license": "MIT",16 "repository": "expressjs/express",17 "homepage": "http://expressjs.com/",18 "keywords": [19 "express",20 "framework",21 "sinatra",
4 unmodified lines
26 "app",27 "api"28 ],29 "dependencies": {29 "accepts": "~1.2.12",30 "accepts": "~1.3.3",31 "array-flatten": "2.0.0",32 "content-disposition": "0.5.1",32 "content-type": "~1.0.1",33 "cookie": "0.1.5",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",39 "finalhandler": "0.4.1",41 "finalhandler": "0.5.0",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",47 "proxy-addr": "~1.0.10",48 "qs": "4.0.0",49 "range-parser": "~1.0.3",49 "proxy-addr": "~1.1.2",50 "qs": "6.2.0",51 "range-parser": "~1.2.0",52 "router": "~1.1.3",51 "send": "0.13.1",52 "serve-static": "~1.10.2",53 "type-is": "~1.6.6",53 "send": "0.14.1",54 "serve-static": "~1.11.1",55 "type-is": "~1.6.13",56 "utils-merge": "1.0.0",55 "vary": "~1.0.1"57 "vary": "~1.1.0"58 },59 "devDependencies": {60 "after": "0.8.1",61 "body-parser": "~1.15.1",62 "cookie-parser": "~1.4.3",59 "ejs": "2.3.4",60 "istanbul": "0.4.2",63 "ejs": "2.4.2",64 "istanbul": "0.4.3",65 "marked": "0.3.5",62 "mocha": "2.3.4",63 "should": "7.1.1",64 "supertest": "1.1.0",65 "body-parser": "~1.14.2",66 "method-override": "~2.3.6",67 "mocha": "2.5.3",68 "morgan": "~1.7.0",69 "should": "9.0.2",70 "supertest": "1.2.0",71 "connect-redis": "~2.4.1",67 "cookie-parser": "~1.4.1",72 "cookie-session": "~1.2.0",73 "express-session": "~1.13.0",74 "jade": "~1.11.0",71 "method-override": "~2.3.5",72 "morgan": "~1.6.1",75 "multiparty": "~4.1.2",74 "vhost": "~3.0.1"76 "vhost": "~3.0.2"77 },78 "engines": {79 "node": ">= 0.10.0"80 },
14 unmodified lines
modified:Readme.md+4 added
35 unmodified lines
36 * Executable for generating applications quickly3738## Docs & Community3940 * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/strongloop/expressjs.com)]41 * [#express](https://webchat.freenode.net/?channels=express) on freenode IRC42 * [Github Organization](https://github.com/expressjs) for Official Middleware & Modules43 * Visit the [Wiki](https://github.com/expressjs/express/wiki)44 * [Google Group](https://groups.google.com/group/express-js) for discussion45 * [Gitter](https://gitter.im/expressjs/express) for support and discussion46 * [Русскоязычная документация](http://jsman.ru/express/)4748**PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/expressjs/express/wiki/New-features-in-4.x).4950###Security Issues5152If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md).53
89 unmodified lines