res.send(ArrayBuffer) silently sends {} as JSON
维护者通常 1 天内回复
@myselfsiddharth 已经在做这个了。
开始于 2026年7月6日。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 86/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- express, javascript, node.js
调研方向
从 lib/response.js 开始,将原始 ArrayBuffer 的处理与现有的 Buffer 和 ArrayBuffer.isView 路径进行比较。完成标准是 res.send(new ArrayBuffer(10)) 发送 10 个零字节,并使用 application/octet-stream 而不是 JSON。
由索引模型根据 Issue 内容生成。
描述
Bug
res.send() handles Buffer and TypedArray (ArrayBuffer.isView) as binary data, but a raw ArrayBuffer — the standard JavaScript binary data type — falls through to this.json(chunk), producing {}withContent-Type: application/json`.
res.send(new ArrayBuffer(10))
// Sends: {} (Content-Type: application/json)
// Expected: 10 zero bytes (Content-Type: application/octet-stream)
Cause
PR #6285 (merged as 55869f49) fixed Uint8Array/DataView support by adding an ArrayBuffer.isView() check. However, ArrayBuffer.isView(new ArrayBuffer(...)) returns false, so raw ArrayBuffer was missed.
Proposed fix
Add an instanceof ArrayBuffer check in lib/response.js that converts to Buffer and sets the binary content type, consistent with the existing ArrayBuffer.isView branch.
Real-world impact
ArrayBuffer is the standard binary type used by fetch, Web Crypto, WebSocket, FileReader, and similar APIs. Passing it directly to res.send() is a common scenario that currently fails silently.
- 主要语言
- JavaScript
- 星标
- 69.7k
- 派生
- 25.6k
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
expressjs/express 的其他 Issue
-
Outdated res.send() syntax in lib/response.js documentation example可能重新可做 关联的 PR 已关闭且未合并。 未关闭docs
难度 1/5 1 小时以内 新手友好度 95/100
expressjs/express#7588 · 1 条评论 ·
维护者通常 1 天内回复
-
4.x deps module:body-parser
难度 1/5 1 小时以内 新手友好度 75/100
expressjs/express#7564 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Update to mocha 12.x可能已有人在做 @ganeshghutukade-04 于 26 天前认领。 未关闭deps
难度 2/5 1-3 小时 新手友好度 67/100
expressjs/express#7547 · 6 条评论 ·
维护者通常 1 天内回复
-
req.subdomains splits an IPv6 host that contains dots可能已有人在做 @johnnyhuirilef 于 30 天前认领。 未关闭4.x 5.x bug
难度 2/5 1-3 小时 新手友好度 72/100
expressjs/express#7532 · 2 条评论 ·
维护者通常 1 天内回复
-
Readme: project name 'express.js' is not capitalized可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 1/5 1 小时以内 新手友好度 95/100
维护者通常 1 天内回复
查看 expressjs/express 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 63/100
anothaDev/luci-theme-vantage#143 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
kingcharleslzy-ai/dsh-purge#282 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
-
a-corriger bug
难度 2/5 1-3 小时 新手友好度 86/100
christian-raj/S-Aloha#340 ·
-
area:image documentation good first issue
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复