- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.2k
 
fix: adds steam clean up #1910
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
fix: adds steam clean up #1910
Conversation
          Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@           Coverage Diff           @@
##           master    #1910   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files           9        9           
  Lines        2074     2081    +7     
=======================================
+ Hits         2072     2079    +7     
  Misses          2        2           ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
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.
Pull Request Overview
This PR addresses a resource leak by ensuring that when a response body stream is replaced with another stream or null value, the original stream is properly destroyed to prevent resource leaks. The fix adds cleanup logic that checks if the original value is a stream and destroys it when it's being replaced, while also preventing unhandled error events during cleanup.
Key Changes:
- Adds stream cleanup logic when a response body stream is replaced
 - Includes error handling to prevent unhandled exceptions during stream destruction
 - Adds comprehensive test coverage for various stream replacement scenarios
 
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description | 
|---|---|
| lib/response.js | Implements stream cleanup logic that destroys the original stream when replaced, with error suppression to prevent unhandled exceptions | 
| tests/response/body.test.js | Adds five test cases covering stream replacement scenarios including cleanup verification and error handling | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
028be8c    to
    995426e      
    Compare
  
    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.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Discription
Adds stream clean-up in addition to nullish value clean-up.
Checklist