-
-
Notifications
You must be signed in to change notification settings - Fork 675
fix: set kBodyUsed only once #4592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4592 +/- ##
=======================================
Coverage 92.94% 92.94%
=======================================
Files 106 106
Lines 32973 32970 -3
=======================================
- Hits 30646 30644 -2
+ Misses 2327 2326 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There is no code coverage. And i guess we can remove this code, because https://nodejs.org/api/stream.html#readablereadabledidread is existing since v14. |
| body[kBodyUsed] = false | ||
| EE.prototype.on.call(body, 'data', function () { | ||
| this[kBodyUsed] = true | ||
| body.once('data', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the initial intention was to avoid tampering, but given that every stream is EE based, it shouldn’t be a problem (bad stream, bad implementation, up to caller).
I’m just more into keep it with this instead of creating another closure; the rest LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. It's not because of tampering but because otherwise the stream will start when registering a data listener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks
|
Streams will start the stream if on is called with |
|
Ok, but the thing is, that the code is not covered by unit tests. |
|
Would be nice to have that fixed. |
@metcoder95 wdyt?
#3294