mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
Compare commits
32 Commits
caa4f68ee8
...
b8ab46594d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8ab46594d | ||
|
|
fedd60e642 | ||
|
|
99a0bd3354 | ||
|
|
dfd1851245 | ||
|
|
9f4dbe3a13 | ||
|
|
9784321e89 | ||
|
|
ee1ef41bd3 | ||
|
|
1ca803dd55 | ||
|
|
73555815b9 | ||
|
|
a1161b4686 | ||
|
|
f9954dd317 | ||
|
|
5da5a11a49 | ||
|
|
3dc96995df | ||
|
|
fa40ecfe76 | ||
|
|
cd7d4397c3 | ||
|
|
4c4f3ea105 | ||
|
|
cb4c56e9a7 | ||
|
|
7b44e1d850 | ||
|
|
eb6d12587a | ||
|
|
f1a2dc884d | ||
|
|
6b51e8ef97 | ||
|
|
1f311c59d4 | ||
|
|
9e97144222 | ||
|
|
29d09803c1 | ||
|
|
1d63162dbf | ||
|
|
4a2175dfc9 | ||
|
|
0bb00e1906 | ||
|
|
1e359f57fc | ||
|
|
9cbe2c2cbb | ||
|
|
35e15362ab | ||
|
|
90e522ac90 | ||
|
|
59703c2321 |
17
.github/dependabot.yml
vendored
Normal file
17
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "23:00"
|
||||
timezone: Europe/London
|
||||
open-pull-requests-limit: 10
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types: ["version-update:semver-major"]
|
||||
23
.github/workflows/ci.yml
vendored
23
.github/workflows/ci.yml
vendored
|
|
@ -13,6 +13,7 @@ on:
|
|||
pull_request:
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -28,9 +29,11 @@ jobs:
|
|||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
|
||||
|
|
@ -45,19 +48,19 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
node-version: [18, 19, 20, 21, 22, 23]
|
||||
node-version: [18, 19, 20, 21, 22, 23, 24]
|
||||
# Node.js release schedule: https://nodejs.org/en/about/releases/
|
||||
|
||||
name: Node.js ${{ matrix.node-version }} - ${{matrix.os}}
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
|
@ -79,7 +82,7 @@ jobs:
|
|||
run: npm run test-ci
|
||||
|
||||
- name: Upload code coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
|
||||
path: ./coverage/lcov.info
|
||||
|
|
@ -92,14 +95,16 @@ jobs:
|
|||
contents: read
|
||||
checks: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install lcov
|
||||
shell: bash
|
||||
run: sudo apt-get -y install lcov
|
||||
|
||||
- name: Collect coverage reports
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
path: ./coverage
|
||||
pattern: coverage-node-*
|
||||
|
|
@ -109,6 +114,6 @@ jobs:
|
|||
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: coverallsapp/github-action@v2
|
||||
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
|
||||
with:
|
||||
file: ./lcov.info
|
||||
|
|
|
|||
20
.github/workflows/codeql.yml
vendored
20
.github/workflows/codeql.yml
vendored
|
|
@ -19,6 +19,7 @@ on:
|
|||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: "0 0 * * 1"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -31,16 +32,25 @@ jobs:
|
|||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [javascript, actions]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
|
||||
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
|
||||
with:
|
||||
languages: javascript
|
||||
languages: ${{ matrix.language }}
|
||||
config: |
|
||||
paths-ignore:
|
||||
- test
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
|
@ -61,6 +71,4 @@ jobs:
|
|||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
|
||||
with:
|
||||
category: "/language:javascript"
|
||||
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
|
||||
|
|
|
|||
17
.github/workflows/legacy.yml
vendored
17
.github/workflows/legacy.yml
vendored
|
|
@ -13,7 +13,8 @@ on:
|
|||
pull_request:
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
|
|
@ -36,12 +37,12 @@ jobs:
|
|||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ jobs:
|
|||
run: npm run test-ci
|
||||
|
||||
- name: Upload code coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
|
||||
path: ./coverage/lcov.info
|
||||
|
|
@ -76,14 +77,16 @@ jobs:
|
|||
contents: read
|
||||
checks: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install lcov
|
||||
shell: bash
|
||||
run: sudo apt-get -y install lcov
|
||||
|
||||
- name: Collect coverage reports
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
path: ./coverage
|
||||
pattern: coverage-node-*
|
||||
|
|
@ -93,6 +96,6 @@ jobs:
|
|||
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: coverallsapp/github-action@v2
|
||||
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
|
||||
with:
|
||||
file: ./lcov.info
|
||||
|
|
|
|||
8
.github/workflows/scorecard.yml
vendored
8
.github/workflows/scorecard.yml
vendored
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
||||
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
|
@ -59,7 +59,7 @@ jobs:
|
|||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
|
|
@ -67,6 +67,6 @@ jobs:
|
|||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
|
||||
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
sarif_file: results.sarif
|
||||
|
|
|
|||
|
|
@ -67,14 +67,15 @@ Currently, any existing [organization member](https://github.com/orgs/expressjs/
|
|||
a new triager. If you are interested in becoming a triager, our best advice is to actively participate
|
||||
in the community by helping triaging issues and pull requests. As well we recommend
|
||||
to engage in other community activities like attending the TC meetings, and participating in the Slack
|
||||
discussions.
|
||||
discussions. If you feel ready and have been helping triage some issues, reach out to an active member of the organization to ask if they'd
|
||||
be willing to support you. If they agree, they can create a pull request to formalize your nomination. In the case of an objection to the nomination, the triage team is responsible for working with the individuals involved and finding a resolution.
|
||||
|
||||
You can also reach out to any of the [organization members](https://github.com/orgs/expressjs/people)
|
||||
if you have questions or need guidance.
|
||||
|
||||
## Becoming a Committer
|
||||
|
||||
All contributors who land a non-trivial contribution should be on-boarded in a timely manner,
|
||||
All contributors who have landed significant and valuable contributions should be onboarded in a timely manner,
|
||||
and added as a committer, and be given write access to the repository.
|
||||
|
||||
Committers are expected to follow this policy and continue to send pull requests, go through
|
||||
|
|
|
|||
39
History.md
39
History.md
|
|
@ -1,28 +1,25 @@
|
|||
unreleased
|
||||
5.1.0 / 2025-03-31
|
||||
========================
|
||||
|
||||
* Remove `utils-merge` dependency - use spread syntax instead
|
||||
* Remove `Object.setPrototypeOf` polyfill
|
||||
* cleanup: remove AsyncLocalStorage check from tests
|
||||
* cleanup: remove unnecessary require for global Buffer
|
||||
* Add support for `Uint8Array` in `res.send()`
|
||||
* Add support for ETag option in `res.sendFile()`
|
||||
* Add support for multiple links with the same rel in `res.links()`
|
||||
* Add funding field to package.json
|
||||
* perf: use loop for acceptParams
|
||||
* Replace `methods` dependency with standard library
|
||||
* refactor: prefix built-in node module imports
|
||||
* Remove unused `depd` dependency
|
||||
* Add support for `Uint8Array` in `res.send`
|
||||
* Add support for ETag option in res.sendFile
|
||||
* Extend res.links() to allow adding multiple links with the same rel
|
||||
* deps: debug@^4.4.0
|
||||
* deps: body-parser@^2.1.0
|
||||
* deps: router@^2.1.0
|
||||
* deps: nyc@^17.1.0
|
||||
* deps: mocha@^10.7.3
|
||||
* deps: marked@^15.0.3
|
||||
* deps: express-session@^1.18.1
|
||||
* deps: ejs@^3.1.10
|
||||
* deps: content-type@^1.0.5
|
||||
* deps: connect-redis@^8.0.1
|
||||
* deps: supertest@^6.3.4
|
||||
* deps: remove `setprototypeof`
|
||||
* deps: remove `safe-buffer`
|
||||
* deps: remove `utils-merge`
|
||||
* deps: remove `methods`
|
||||
* deps: remove `depd`
|
||||
* deps: `debug@^4.4.0`
|
||||
* deps: `body-parser@^2.2.0`
|
||||
* deps: `router@^2.2.0`
|
||||
* deps: `content-type@^1.0.5`
|
||||
* deps: `finalhandler@^2.1.0`
|
||||
* deps: `qs@^6.14.0`
|
||||
* deps: `server-static@2.2.0`
|
||||
* deps: `type-is@2.0.1`
|
||||
|
||||
5.0.1 / 2024-10-08
|
||||
==========
|
||||
|
|
|
|||
14
Readme.md
14
Readme.md
|
|
@ -200,14 +200,9 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
|
|||
* [bjohansebas](https://github.com/bjohansebas) - **Sebastian Beltran**
|
||||
* [carpasse](https://github.com/carpasse) - **Carlos Serrano**
|
||||
* [CBID2](https://github.com/CBID2) - **Christine Belzie**
|
||||
* [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim**
|
||||
* [dpopp07](https://github.com/dpopp07) - **Dustin Popp**
|
||||
* [UlisesGascon](https://github.com/UlisesGascon) - **Ulises Gascón** (he/him)
|
||||
* [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin**
|
||||
* [0ss](https://github.com/0ss) - **Salah**
|
||||
* [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him)
|
||||
* [3imed-jaberi](https://github.com/3imed-jaberi) - **Imed Jaberi**
|
||||
* [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him)
|
||||
* [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego**
|
||||
* [IamLizu](https://github.com/IamLizu) - **S M Mahmudul Hasan** (he/him)
|
||||
* [Phillip9587](https://github.com/Phillip9587) - **Phillip Barta**
|
||||
* [Sushmeet](https://github.com/Sushmeet) - **Sushmeet Sunger**
|
||||
|
|
@ -244,6 +239,13 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
|
|||
* [sheplu](https://github.com/sheplu) - **Jean Burellier**
|
||||
* [tarunyadav1](https://github.com/tarunyadav1) - **Tarun yadav**
|
||||
* [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe**
|
||||
* [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim**
|
||||
* [0ss](https://github.com/0ss) - **Salah**
|
||||
* [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him)
|
||||
* [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him)
|
||||
* [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego**
|
||||
* [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin**
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -169,9 +169,8 @@ req.acceptsCharsets = function(){
|
|||
* @public
|
||||
*/
|
||||
|
||||
req.acceptsLanguages = function(){
|
||||
var accept = accepts(this);
|
||||
return accept.languages.apply(accept, arguments);
|
||||
req.acceptsLanguages = function(...languages) {
|
||||
return accepts(this).languages(...languages);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
16
package.json
16
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "express",
|
||||
"description": "Fast, unopinionated, minimalist web framework",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.0",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Aaron Heckmann <aaron.heckmann+github@gmail.com>",
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.1.0",
|
||||
"body-parser": "^2.2.0",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "^1.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"finalhandler": "^2.0.0",
|
||||
"finalhandler": "^2.1.0",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
|
|
@ -51,20 +51,20 @@
|
|||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.13.0",
|
||||
"qs": "^6.14.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.1.0",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.1.0",
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.0",
|
||||
"type-is": "^2.0.1",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"after": "0.8.2",
|
||||
"connect-redis": "^8.0.1",
|
||||
"cookie-parser": "1.4.7",
|
||||
"cookie-session": "2.0.0",
|
||||
"cookie-session": "2.1.0",
|
||||
"ejs": "^3.1.10",
|
||||
"eslint": "8.47.0",
|
||||
"express-session": "^1.18.1",
|
||||
|
|
|
|||
|
|
@ -24,4 +24,32 @@ describe('app.listen()', function(){
|
|||
})
|
||||
})
|
||||
})
|
||||
it('accepts port + hostname + backlog + callback', function (done) {
|
||||
const app = express();
|
||||
const server = app.listen(0, '127.0.0.1', 5, function () {
|
||||
const { address, port } = server.address();
|
||||
assert.strictEqual(address, '127.0.0.1');
|
||||
assert(Number.isInteger(port) && port > 0);
|
||||
// backlog isn’t directly inspectable, but if no error was thrown
|
||||
// we know it was accepted.
|
||||
server.close(done);
|
||||
});
|
||||
});
|
||||
it('accepts just a callback (no args)', function (done) {
|
||||
const app = express();
|
||||
// same as app.listen(0, done)
|
||||
const server = app.listen();
|
||||
server.close(done);
|
||||
});
|
||||
it('server.address() gives a { address, port, family } object', function (done) {
|
||||
const app = express();
|
||||
const server = app.listen(0, () => {
|
||||
const addr = server.address();
|
||||
assert(addr && typeof addr === 'object');
|
||||
assert.strictEqual(typeof addr.address, 'string');
|
||||
assert(Number.isInteger(addr.port) && addr.port > 0);
|
||||
assert(typeof addr.family === 'string');
|
||||
server.close(done);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1156,7 +1156,7 @@ describe('app.router', function () {
|
|||
assert.strictEqual(app.get('/', function () { }), app)
|
||||
})
|
||||
|
||||
it('should should not use disposed router/middleware', function (done) {
|
||||
it('should not use disposed router/middleware', function (done) {
|
||||
// more context: https://github.com/expressjs/express/issues/5743#issuecomment-2277148412
|
||||
|
||||
var app = express();
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ describe('express.json()', function () {
|
|||
this.app = app
|
||||
})
|
||||
|
||||
it('should presist store', function (done) {
|
||||
it('should persist store', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/json')
|
||||
|
|
@ -561,7 +561,7 @@ describe('express.json()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflated', function (done) {
|
||||
it('should persist store when inflated', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'application/json')
|
||||
|
|
@ -572,7 +572,7 @@ describe('express.json()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflate error', function (done) {
|
||||
it('should persist store when inflate error', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'application/json')
|
||||
|
|
@ -582,7 +582,7 @@ describe('express.json()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when parse error', function (done) {
|
||||
it('should persist store when parse error', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/json')
|
||||
|
|
@ -592,7 +592,7 @@ describe('express.json()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when limit exceeded', function (done) {
|
||||
it('should persist store when limit exceeded', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/json')
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ describe('express.raw()', function () {
|
|||
this.app = app
|
||||
})
|
||||
|
||||
it('should presist store', function (done) {
|
||||
it('should persist store', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/octet-stream')
|
||||
|
|
@ -379,7 +379,7 @@ describe('express.raw()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when unmatched content-type', function (done) {
|
||||
it('should persist store when unmatched content-type', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/fizzbuzz')
|
||||
|
|
@ -389,7 +389,7 @@ describe('express.raw()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflated', function (done) {
|
||||
it('should persist store when inflated', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'application/octet-stream')
|
||||
|
|
@ -400,7 +400,7 @@ describe('express.raw()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflate error', function (done) {
|
||||
it('should persist store when inflate error', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'application/octet-stream')
|
||||
|
|
@ -410,7 +410,7 @@ describe('express.raw()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when limit exceeded', function (done) {
|
||||
it('should persist store when limit exceeded', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/octet-stream')
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ describe('express.text()', function () {
|
|||
this.app = app
|
||||
})
|
||||
|
||||
it('should presist store', function (done) {
|
||||
it('should persist store', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'text/plain')
|
||||
|
|
@ -408,7 +408,7 @@ describe('express.text()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when unmatched content-type', function (done) {
|
||||
it('should persist store when unmatched content-type', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/fizzbuzz')
|
||||
|
|
@ -418,7 +418,7 @@ describe('express.text()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflated', function (done) {
|
||||
it('should persist store when inflated', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'text/plain')
|
||||
|
|
@ -429,7 +429,7 @@ describe('express.text()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflate error', function (done) {
|
||||
it('should persist store when inflate error', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'text/plain')
|
||||
|
|
@ -439,7 +439,7 @@ describe('express.text()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when limit exceeded', function (done) {
|
||||
it('should persist store when limit exceeded', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'text/plain')
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ describe('express.urlencoded()', function () {
|
|||
this.app = app
|
||||
})
|
||||
|
||||
it('should presist store', function (done) {
|
||||
it('should persist store', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/x-www-form-urlencoded')
|
||||
|
|
@ -653,7 +653,7 @@ describe('express.urlencoded()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when unmatched content-type', function (done) {
|
||||
it('should persist store when unmatched content-type', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/fizzbuzz')
|
||||
|
|
@ -663,7 +663,7 @@ describe('express.urlencoded()', function () {
|
|||
.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflated', function (done) {
|
||||
it('should persist store when inflated', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'application/x-www-form-urlencoded')
|
||||
|
|
@ -674,7 +674,7 @@ describe('express.urlencoded()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when inflate error', function (done) {
|
||||
it('should persist store when inflate error', function (done) {
|
||||
var test = request(this.app).post('/')
|
||||
test.set('Content-Encoding', 'gzip')
|
||||
test.set('Content-Type', 'application/x-www-form-urlencoded')
|
||||
|
|
@ -684,7 +684,7 @@ describe('express.urlencoded()', function () {
|
|||
test.end(done)
|
||||
})
|
||||
|
||||
it('should presist store when limit exceeded', function (done) {
|
||||
it('should persist store when limit exceeded', function (done) {
|
||||
request(this.app)
|
||||
.post('/')
|
||||
.set('Content-Type', 'application/x-www-form-urlencoded')
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ describe('res', function(){
|
|||
})
|
||||
|
||||
describe('async local storage', function () {
|
||||
it('should presist store', function (done) {
|
||||
it('should persist store', function (done) {
|
||||
var app = express()
|
||||
var cb = after(2, done)
|
||||
var store = { foo: 'bar' }
|
||||
|
|
@ -116,7 +116,7 @@ describe('res', function(){
|
|||
.expect(200, 'tobi', cb)
|
||||
})
|
||||
|
||||
it('should presist store on error', function (done) {
|
||||
it('should persist store on error', function (done) {
|
||||
var app = express()
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ function test(app) {
|
|||
})
|
||||
|
||||
describe('when no match is made', function(){
|
||||
it('should should respond with 406 not acceptable', function(done){
|
||||
it('should respond with 406 not acceptable', function(done){
|
||||
request(app)
|
||||
.get('/')
|
||||
.set('Accept', 'foo/bar')
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ describe('res', function(){
|
|||
})
|
||||
|
||||
describe('async local storage', function () {
|
||||
it('should presist store', function (done) {
|
||||
it('should persist store', function (done) {
|
||||
var app = express()
|
||||
var cb = after(2, done)
|
||||
var store = { foo: 'bar' }
|
||||
|
|
@ -304,7 +304,7 @@ describe('res', function(){
|
|||
.expect(200, 'tobi', cb)
|
||||
})
|
||||
|
||||
it('should presist store on error', function (done) {
|
||||
it('should persist store on error', function (done) {
|
||||
var app = express()
|
||||
var store = { foo: 'bar' }
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ function getMajorVersion(versionString) {
|
|||
}
|
||||
|
||||
function shouldSkipQuery(versionString) {
|
||||
// Skipping HTTP QUERY tests on Node 21, it is reported in http.METHODS on 21.7.2 but not supported
|
||||
// update this implementation to run on supported versions of 21 once they exist
|
||||
// Skipping HTTP QUERY tests below Node 22, QUERY wasn't fully supported by Node until 22
|
||||
// we could update this implementation to run on supported versions of 21 once they exist
|
||||
// upstream tracking https://github.com/nodejs/node/issues/51562
|
||||
// express tracking issue: https://github.com/expressjs/express/issues/5615
|
||||
return Number(getMajorVersion(versionString)) === 21
|
||||
return Number(getMajorVersion(versionString)) < 22
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,18 @@ describe('utils.etag(body, encoding)', function(){
|
|||
})
|
||||
})
|
||||
|
||||
describe('utils.normalizeType acceptParams method', () => {
|
||||
it('should handle a type with a malformed parameter and break the loop in acceptParams', () => {
|
||||
const result = utils.normalizeType('text/plain;invalid');
|
||||
assert.deepEqual(result,{
|
||||
value: 'text/plain',
|
||||
quality: 1,
|
||||
params: {} // No parameters are added since "invalid" has no "="
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('utils.setCharset(type, charset)', function () {
|
||||
it('should do anything without type', function () {
|
||||
assert.strictEqual(utils.setCharset(), undefined);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user