{
 "article": "/articles/express-5-2-1-and-5-3-0-4-content-length-tests-flip-19864c36/",
 "lab": {
  "checks": [
   {
    "name": "should not add Content-Length header if Transfer-Encoding header is equal to chunked",
    "outcomes": {
     "5.2.1": "fail",
     "5.3.0": "pass"
    },
    "source": "https://github.com/expressjs/express/blob/18e5985b8a9d5e8423db0a9121f22bdaecd5b120/test/res.send.js"
   },
   {
    "name": "should not add Content-Length header if Transfer-Encoding header is equal to compress",
    "outcomes": {
     "5.2.1": "fail",
     "5.3.0": "pass"
    },
    "source": "https://github.com/expressjs/express/blob/18e5985b8a9d5e8423db0a9121f22bdaecd5b120/test/res.send.js"
   },
   {
    "name": "should not add Content-Length header if Transfer-Encoding header is equal to deflate",
    "outcomes": {
     "5.2.1": "fail",
     "5.3.0": "pass"
    },
    "source": "https://github.com/expressjs/express/blob/18e5985b8a9d5e8423db0a9121f22bdaecd5b120/test/res.send.js"
   },
   {
    "name": "should not add Content-Length header if Transfer-Encoding header is equal to gzip",
    "outcomes": {
     "5.2.1": "fail",
     "5.3.0": "pass"
    },
    "source": "https://github.com/expressjs/express/blob/18e5985b8a9d5e8423db0a9121f22bdaecd5b120/test/res.send.js"
   }
  ],
  "claims": [],
  "commands": [
   "docker run --rm -it node:22-slim bash",
   "npm install --ignore-scripts express@5.2.1 mocha@^11.7.5 supertest@^6.3.0 (and 5.3.0 in a second container)",
   "Copy test/ from https://github.com/expressjs/express/tree/18e5985b8a9d5e8423db0a9121f22bdaecd5b120 into node_modules/express/ (with its helpers)",
   "npx mocha --check-leaks node_modules/express/test/res.send.js"
  ],
  "date": "2026-11-26",
  "family": "fix",
  "findings": [
   {
    "kind": "fix",
    "text": "should not add Content-Length header if Transfer-Encoding header is equal to chunked: 5.2.1 fails, 5.3.0 passes"
   },
   {
    "kind": "fix",
    "text": "should not add Content-Length header if Transfer-Encoding header is equal to compress: 5.2.1 fails, 5.3.0 passes"
   },
   {
    "kind": "fix",
    "text": "should not add Content-Length header if Transfer-Encoding header is equal to deflate: 5.2.1 fails, 5.3.0 passes"
   },
   {
    "kind": "fix",
    "text": "should not add Content-Length header if Transfer-Encoding header is equal to gzip: 5.2.1 fails, 5.3.0 passes"
   }
  ],
  "limits": [
   "Only the tests that the fix commit added or changed count; the package's other tests are not part of this check.",
   "The published package from npm is tested, not the repository's source, on Node.js 22 only.",
   "A passing test shows the fixed behaviour on our machine; it is not a security audit of the package."
  ],
  "method": [
   "The tests that commit 18e5985 added or changed (test/res.send.js), read from expressjs/express at that commit and run unchanged with mocha against each published version",
   "Which tests it added or changed: each test's name and code at the commit against the commit before it, listed with mocha --dry-run",
   "Each version in its own container: installed from npm without install scripts, then the network cut",
   "Before the vendor's tests went in, each container was read back: no mount, network or device, no added rights, not root; it was removed after",
   "5.3.0 ran the tests twice, in two containers (the self-test)"
  ],
  "product": "Express",
  "question": "Do the tests Express's fix added fail on 5.2.1 and pass on 5.3.0?",
  "results": [],
  "rig": {
   "cpu": "AMD Ryzen 7 7800X3D (8 cores, 16 threads)",
   "docker": "Docker Engine 29.9.3",
   "driver": "",
   "gpu": "",
   "os": "Windows 11 Pro, Docker Desktop (WSL 2)",
   "ram": "32 GB"
  },
  "schema": 1,
  "self_test": {
   "clear": 0,
   "max_delta_pct": 0.0,
   "name": "5.3.0 against 5.3.0: the fix's tests twice"
  },
  "subjects": [
   {
    "digest": "sha256:e9f565d32859f0cbfb52125eafe8be39390f24dac302dc3cdf566e8ba3ab21ee",
    "image": "express 5.2.1 on node:22-slim",
    "label": "5.2.1"
   },
   {
    "digest": "sha256:e9f565d32859f0cbfb52125eafe8be39390f24dac302dc3cdf566e8ba3ab21ee",
    "image": "express 5.3.0 on node:22-slim",
    "label": "5.3.0"
   }
  ]
 }
}