Skip to content

Commit 6eeb3e7

Browse files
ronagmetcoder95
authored andcommitted
perf: use stream.isReadable when available
1 parent 87c4d65 commit 6eeb3e7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/core/util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,11 @@ function isErrored (body) {
263263
}
264264

265265
function isReadable (body) {
266-
return !!(body && /state: 'readable'/.test(nodeUtil.inspect(body)))
266+
return !!(body && (
267+
stream.isReadable
268+
? stream.isReadable(body)
269+
: /state: 'readable'/.test(nodeUtil.inspect(body)
270+
)))
267271
}
268272

269273
function getSocketInfo (socket) {

0 commit comments

Comments
 (0)