Skip to content

Commit 1fcd7e7

Browse files
committed
fix: 避免 end 事件不触发而没有记录信息
- 例如当运行命令 `http :9000/image/jpeg` 时, 在命令行并不会读取图片内容, 这导致 end 事件不会触发
1 parent f82cfb4 commit 1fcd7e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/util/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,8 @@ function business() { // 与业务相关性较大的函数
13241324
} else {
13251325
res.on('data', function(chunk) {
13261326
data.push(chunk)
1327-
}).on('end', function() {
1327+
})
1328+
req.on('close', function() {
13281329
const buffer = Buffer.concat(data)
13291330
createHttpHistory({...arg, buffer})
13301331
})

0 commit comments

Comments
 (0)