Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: expressjs/express
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d854c43ea177d1faeea56189249fff8c24a764bd
Choose a base ref
...
head repository: expressjs/express
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8368dc178af16b91b576c4c1d135f701a0007e5d
Choose a head ref
  • 18 commits
  • 10 files changed
  • 4 contributors

Commits on May 20, 2022

  1. build: mocha@10.0.0

    dougwilson committed May 20, 2022
    Copy the full SHA
    a2dfc56 View commit details
  2. build: ejs@3.1.8

    dougwilson committed May 20, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    745a63f View commit details
  3. build: Node.js@18.1

    dougwilson committed May 20, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ab2c70b View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7ec5dd2 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    97f0a51 View commit details
  6. examples: remove unused function arguments in params

    closes #4914
    alxdrg authored and dougwilson committed May 20, 2022
    Copy the full SHA
    2c47827 View commit details

Commits on Aug 19, 2022

  1. build: Node.js@16.17

    dougwilson committed Aug 19, 2022
    Copy the full SHA
    8d98e86 View commit details
  2. build: Node.js@18.7

    dougwilson committed Aug 19, 2022
    Copy the full SHA
    97131bc View commit details
  3. build: Node.js@14.20

    dougwilson committed Aug 19, 2022
    Copy the full SHA
    ecd7572 View commit details
  4. build: supertest@6.2.4

    dougwilson committed Aug 19, 2022
    Copy the full SHA
    644f646 View commit details

Commits on Aug 20, 2022

  1. docs: use Node.js name style

    closes #4926
    REALSTEVEIG authored and dougwilson committed Aug 20, 2022
    Copy the full SHA
    33e8dc3 View commit details

Commits on Oct 6, 2022

  1. build: eslint@8.24.0

    dougwilson committed Oct 6, 2022
    Copy the full SHA
    340be0f View commit details
  2. deps: body-parser@1.20.1

    dougwilson committed Oct 6, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    689d175 View commit details
  3. deps: qs@6.11.0

    dougwilson committed Oct 6, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    24b3dc5 View commit details
  4. build: supertest@6.3.0

    dougwilson committed Oct 6, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f56ce73 View commit details

Commits on Oct 7, 2022

  1. build: Node.js@18.10

    closes #5014
    dougwilson committed Oct 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bb7907b View commit details

Commits on Oct 8, 2022

  1. docs: replace Freenode with Libera Chat

    closes #5013
    theabhinavdas authored and dougwilson committed Oct 8, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    61f4049 View commit details
  2. 4.18.2

    dougwilson committed Oct 8, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8368dc1 View commit details
Showing with 75 additions and 33 deletions.
  1. +7 −5 .github/workflows/ci.yml
  2. +9 −0 History.md
  3. +2 −2 Readme.md
  4. +6 −3 appveyor.yml
  5. +2 −2 examples/params/index.js
  6. +8 −8 lib/router/route.js
  7. +7 −7 package.json
  8. +10 −1 test/Route.js
  9. +20 −2 test/Router.js
  10. +4 −3 test/res.sendFile.js
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -87,24 +87,26 @@ jobs:

- name: Node.js 12.x
node-version: "12.22"
npm-i: mocha@9.2.2

- name: Node.js 13.x
node-version: "13.14"
npm-i: mocha@9.2.2

- name: Node.js 14.x
node-version: "14.19"
node-version: "14.20"

- name: Node.js 15.x
node-version: "15.14"

- name: Node.js 16.x
node-version: "16.15"
node-version: "16.17"

- name: Node.js 17.x
node-version: "17.9"

- name: Node.js 18.x
node-version: "18.0"
node-version: "18.10"

steps:
- uses: actions/checkout@v2
@@ -131,8 +133,8 @@ jobs:
shell: bash
run: |
# eslint for linting
# - remove on Node.js < 10
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
# - remove on Node.js < 12
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
grep -E '^eslint(-|$)' | \
sort -r | \
9 changes: 9 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
4.18.2 / 2022-10-08
===================

* Fix regression routing a large stack in a single route
* deps: body-parser@1.20.1
- deps: qs@6.11.0
- perf: remove unnecessary object clone
* deps: qs@6.11.0

4.18.1 / 2022-04-29
===================

4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/)

Fast, unopinionated, minimalist web framework for [node](http://nodejs.org).
Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org).

[![NPM Version][npm-version-image]][npm-url]
[![NPM Install Size][npm-install-size-image]][npm-install-size-url]
@@ -51,7 +51,7 @@ for more information.
## Docs & Community

* [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)]
* [#express](https://webchat.freenode.net/?channels=express) on freenode IRC
* [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC
* [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules
* Visit the [Wiki](https://github.com/expressjs/express/wiki)
* [Google Group](https://groups.google.com/group/express-js) for discussion
9 changes: 6 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -15,11 +15,11 @@ environment:
- nodejs_version: "11.15"
- nodejs_version: "12.22"
- nodejs_version: "13.14"
- nodejs_version: "14.19"
- nodejs_version: "14.20"
- nodejs_version: "15.14"
- nodejs_version: "16.15"
- nodejs_version: "16.17"
- nodejs_version: "17.9"
- nodejs_version: "18.0"
- nodejs_version: "18.10"
cache:
- node_modules
install:
@@ -47,6 +47,7 @@ install:
# - use 6.x for Node.js < 8
# - use 7.x for Node.js < 10
# - use 8.x for Node.js < 12
# - use 9.x for Node.js < 14
if ([int]$env:nodejs_version.split(".")[0] -lt 4) {
npm install --silent --save-dev mocha@3.5.3
} elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {
@@ -57,6 +58,8 @@ install:
npm install --silent --save-dev mocha@7.2.0
} elseif ([int]$env:nodejs_version.split(".")[0] -lt 12) {
npm install --silent --save-dev mocha@8.4.0
} elseif ([int]$env:nodejs_version.split(".")[0] -lt 14) {
npm install --silent --save-dev mocha@9.2.2
}
- ps: |
# nyc for test coverage
4 changes: 2 additions & 2 deletions examples/params/index.js
Original file line number Diff line number Diff line change
@@ -51,15 +51,15 @@ app.get('/', function(req, res){
* GET :user.
*/

app.get('/user/:user', function(req, res, next){
app.get('/user/:user', function (req, res) {
res.send('user ' + req.user.name);
});

/**
* GET users :from - :to.
*/

app.get('/users/:from-:to', function(req, res, next){
app.get('/users/:from-:to', function (req, res) {
var from = req.params.from;
var to = req.params.to;
var names = users.map(function(user){ return user.name; });
16 changes: 8 additions & 8 deletions lib/router/route.js
Original file line number Diff line number Diff line change
@@ -124,21 +124,21 @@ Route.prototype.dispatch = function dispatch(req, res, done) {
return done(err)
}

var layer = stack[idx++];
if (!layer) {
return done(err);
}

// max sync stack
if (++sync > 100) {
return setImmediate(next, err)
}

if (layer.method && layer.method !== method) {
return next(err);
var layer = stack[idx++]

// end of layers
if (!layer) {
return done(err)
}

if (err) {
if (layer.method && layer.method !== method) {
next(err)
} else if (err) {
layer.handle_error(err, req, res, next);
} else {
layer.handle_request(req, res, next);
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "express",
"description": "Fast, unopinionated, minimalist web framework",
"version": "4.18.1",
"version": "4.18.2",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
"Aaron Heckmann <aaron.heckmann+github@gmail.com>",
@@ -30,7 +30,7 @@
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "1.20.0",
"body-parser": "1.20.1",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.5.0",
@@ -49,7 +49,7 @@
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.7",
"qs": "6.10.3",
"qs": "6.11.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
@@ -65,18 +65,18 @@
"connect-redis": "3.4.2",
"cookie-parser": "1.4.6",
"cookie-session": "2.0.0",
"ejs": "3.1.7",
"eslint": "7.32.0",
"ejs": "3.1.8",
"eslint": "8.24.0",
"express-session": "1.17.2",
"hbs": "4.2.0",
"marked": "0.7.0",
"method-override": "3.0.0",
"mocha": "9.2.2",
"mocha": "10.0.0",
"morgan": "1.10.0",
"multiparty": "4.2.3",
"nyc": "15.1.0",
"pbkdf2-password": "1.2.1",
"supertest": "6.2.3",
"supertest": "6.3.0",
"vhost": "~3.0.2"
},
"engines": {
11 changes: 10 additions & 1 deletion test/Route.js
Original file line number Diff line number Diff line change
@@ -19,8 +19,16 @@ describe('Route', function(){
var req = { method: 'GET', url: '/' }
var route = new Route('/foo')

route.get(function (req, res, next) {
req.counter = 0
next()
})

for (var i = 0; i < 6000; i++) {
route.all(function (req, res, next) { next() })
route.all(function (req, res, next) {
req.counter++
next()
})
}

route.get(function (req, res, next) {
@@ -31,6 +39,7 @@ describe('Route', function(){
route.dispatch(req, {}, function (err) {
if (err) return done(err)
assert.ok(req.called)
assert.strictEqual(req.counter, 6000)
done()
})
})
22 changes: 20 additions & 2 deletions test/Router.js
Original file line number Diff line number Diff line change
@@ -83,11 +83,20 @@ describe('Router', function(){

var router = new Router()

router.get('/foo', function (req, res, next) {
req.counter = 0
next()
})

for (var i = 0; i < 6000; i++) {
router.get('/foo', function (req, res, next) { next() })
router.get('/foo', function (req, res, next) {
req.counter++
next()
})
}

router.get('/foo', function (req, res) {
assert.strictEqual(req.counter, 6000)
res.end()
})

@@ -99,11 +108,20 @@ describe('Router', function(){

var router = new Router()

router.use(function (req, res, next) {
req.counter = 0
next()
})

for (var i = 0; i < 6000; i++) {
router.use(function (req, res, next) { next() })
router.use(function (req, res, next) {
req.counter++
next()
})
}

router.use(function (req, res) {
assert.strictEqual(req.counter, 6000)
res.end()
})

7 changes: 4 additions & 3 deletions test/res.sendFile.js
Original file line number Diff line number Diff line change
@@ -1050,12 +1050,13 @@ describe('res', function(){

app.use(function(req, res){
res.sendfile('test/fixtures/user.html', function(err){
assert(!res.headersSent);
assert.strictEqual(req.socket.listeners('error').length, 1) // node's original handler
assert.ok(err)
assert.ok(!res.headersSent)
assert.strictEqual(err.message, 'broken!')
done();
});

req.socket.emit('error', new Error('broken!'));
req.socket.destroy(new Error('broken!'))
});

request(app)