Skip to content

replace on-finished with stream.finished#95

Closed
bjohansebas wants to merge 1 commit into
pillarjs:masterfrom
bjohansebas:on-finished
Closed

replace on-finished with stream.finished#95
bjohansebas wants to merge 1 commit into
pillarjs:masterfrom
bjohansebas:on-finished

Conversation

@bjohansebas
Copy link
Copy Markdown
Member

on-finished can be replaced by finished, isFinished is still required for future maintainability

Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
Copy link
Copy Markdown

Copilot AI left a 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 pull request replaces the usage of on-finished with the built-in stream.finished for flushing the request, while still maintaining the isFinished check via on-finished for future maintainability.

  • Replaces onFinished(req, write) with finished(req, write)
  • Removes redundant module variables and adjusts variable declarations accordingly
Comments suppressed due to low confidence (1)

index.js:18

  • [nitpick] Consider using 'const' instead of 'var' for 'isFinished' to promote immutability and maintain consistency with other modern declarations.
var isFinished = require('on-finished').isFinished

@Phillip9587
Copy link
Copy Markdown
Contributor

I really like the direction of this change - using stream.finished is definitely a cleaner and more modern approach. However, I'd be in favor of implementing this improvement directly within the on-finished package and releasing it as a new major version.

This way, we can centralize the logic, maintain consistency for our packages that depend on on-finished, and allow consumers to benefit from the native stream.finished without having to refactor their own usage across different codebases.

Curious to hear your thoughts on this approach!

@bjohansebas
Copy link
Copy Markdown
Member Author

Closing since version 3 of on-finished is being worked on.

@bjohansebas bjohansebas deleted the on-finished branch July 12, 2025 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants