Skip to content
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

Replace deprecated flush() with flushHeaders() #7

Closed
wants to merge 1 commit into from
Closed

Replace deprecated flush() with flushHeaders() #7

wants to merge 1 commit into from

Conversation

wKovacs64
Copy link
Contributor

Node was complaining about the use of the now-deprecated flush() function:

OutgoingMessage.flush is deprecated. Use flushHeaders instead.

Replacing flush() with flushHeaders() removes the warning.

OutgoingMessage.flush is deprecated. Use flushHeaders instead.

nodejs/node#1156
@rexxars
Copy link
Owner

rexxars commented Dec 19, 2015

Hrm. Thanks for the PR, but I don't think this does what we expect it to. The flush is only actually meant to be called when using the compression-middleware for express (or similar), as that triggers the gzip stream to be flushed. This PR will actually remove this functionality in favor of preventing some deprecation warnings.

Not 100% sure how to solve this. The best solution would be something that only triggered flush() if the response is a compressed one, otherwise don't call flush/flushHeaders at all.

@wKovacs64
Copy link
Contributor Author

Yeah I was uncertain of this as well. Although it sounded like they just added flushHeaders and deprecated flush rather than renaming flush so I assume they do the same thing. Perhaps not?

@rexxars
Copy link
Owner

rexxars commented Dec 19, 2015

It's the same on plain Node responses, however the compression middleware monkey-patches a new flush method on top of the response which calls flush on the underlying gzip stream. It's confusing.

@wKovacs64
Copy link
Contributor Author

I see what you mean. Closing this for now, further research required.

@wKovacs64 wKovacs64 closed this Dec 19, 2015
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