Skip to content

Change res.flush to accept a callback function argument #227

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

Merged
merged 4 commits into from
Apr 16, 2025

Conversation

bjohansebas
Copy link
Member

@bjohansebas bjohansebas commented Apr 16, 2025

Well, #57 has maintainer edits disabled, so I created this PR with @bijoythomas's changes and added tests for Brotli :)

Closes #57

@bjohansebas bjohansebas requested a review from Copilot April 16, 2025 17:57
Copy link

@Copilot 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.

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

function write () {
chunks++
if (chunks === 20) return resp.end()
if (chunks > 20) return chunks--
Copy link
Preview

Copilot AI Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of a decrement operator within the return statement to handle chunk overflow is ambiguous and may lead to unintended behavior. Consider revising the logic with an explicit conditional check to prevent writing beyond the intended chunk count.

Suggested change
if (chunks > 20) return chunks--
if (chunks > 20) {
chunks--;
return;
}

Copilot uses AI. Check for mistakes.

Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedmocha@​9.2.2 ⏵ 10.8.297 +110094 +196100

View full report

@bjohansebas
Copy link
Member Author

Since this was already reviewed in #57, I'm going to merge it and it's all good.

@bjohansebas bjohansebas merged commit e2abcbf into v2 Apr 16, 2025
16 checks passed
@bjohansebas bjohansebas deleted the bijoythomas/master branch April 16, 2025 18:10
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.

2 participants