You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
res.send(DataView) silently drops the view’s bytes #7510
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:
constexpress=require('express')constapp=express()app.get('/',(req,res)=>{constbytes=newUint8Array([0,1,2,3,0])res.send(newDataView(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.
Activity