-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use express response methods #2842
Conversation
We should not bypass the express conventions here. Doing so prevents other middleware from working as intended. This includes `graphql-upload`, which is currently unable to force the response to wait for the request to be fully consumed, and causes severe bugs, including locking a browser out of subsequent requests to the server. See: jaydenseric/graphql-upload#152 (comment)
Does this also need to be fixed in the other middleware packages such as |
The koa middle correctly follows the koa convention of using However, all of the upload middleware that are build in to the various I created issue #2843 for this separate, larger problem. |
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.
LGTM / Thanks, @mike-marcacci. I certainly agree that using send
here is more appropriate.
I've added a commit which falls back to calling end
when send
isn't available, which should satisfy connect
's desires (and if tests are any barometer, the additional commit has resolved the failures).
As you've noted in your other PR, there's certainly room for additional improvement here, and while this code has gone relatively unchanged for almost 3 years, this change should still be an improvement worth getting in ASAP.
We should not bypass the express convention of using
res.send
here. Doing so prevents other middleware from working as intended.This includes
graphql-upload
, which is currently unable to force the response to wait for the request to be fully consumed, and causes severe bugs, including locking a browser out of subsequent requests to the server.Please see this issue and the accompanying demonstration repo put together with heroic effort by @juona.