res.send() recognizes DataView as binary via ArrayBuffer.isView(), but later calls Buffer.from(dataView), which produces an empty Buffer. A non-empty view therefore returns HTTP 200 with Content-Length: 0.
Reproduced with Express 5.2.1, current master (9efc29e), Node 24.14.1, Linux:
const express = require('express')
const app = express()
app.get('/', (req, res) => {
const bytes = new Uint8Array([0, 1, 2, 3, 0])
res.send(new DataView(bytes.buffer, 1, 3))
})
app.listen(3000)
// GET / returns an empty response instead of the bytes 01 02 03.
Expected: send exactly the DataView's byte range, with the correct Content-Length and ETag. The bug also occurs with ETags disabled and with cross-realm views.
This revisits the DataView-specific problem from #7433, which its author closed without merging. It is separate from bare ArrayBuffer support in #7362.
A focused patch is ready: detect DataViews with node:util.types.isDataView, then convert only their backing byte range. Buffer and other typed-array behavior remain unchanged, including the Uint16Array compatibility concern raised in #7433.
The patch adds 11 regression cases (eight fail before the fix); all 1,272 tests pass with npm run test-ci, and npm run lint passes. No dependency changes.
AI assistance was used for investigation, implementation, and local validation.
res.send()recognizes DataView as binary viaArrayBuffer.isView(), but later callsBuffer.from(dataView), which produces an empty Buffer. A non-empty view therefore returns HTTP 200 withContent-Length: 0.Reproduced with Express 5.2.1, current master (
9efc29e), Node 24.14.1, Linux:Expected: send exactly the DataView's byte range, with the correct Content-Length and ETag. The bug also occurs with ETags disabled and with cross-realm views.
This revisits the DataView-specific problem from #7433, which its author closed without merging. It is separate from bare ArrayBuffer support in #7362.
A focused patch is ready: detect DataViews with
node:util.types.isDataView, then convert only their backing byte range. Buffer and other typed-array behavior remain unchanged, including the Uint16Array compatibility concern raised in #7433.The patch adds 11 regression cases (eight fail before the fix); all 1,272 tests pass with
npm run test-ci, andnpm run lintpasses. No dependency changes.AI assistance was used for investigation, implementation, and local validation.