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

Error when response already destroyed #1941

Open
3 tasks done
misyuari opened this issue Feb 5, 2023 · 0 comments
Open
3 tasks done

Error when response already destroyed #1941

misyuari opened this issue Feb 5, 2023 · 0 comments

Comments

@misyuari
Copy link

misyuari commented Feb 5, 2023

  • Used appropriate template for the issue type
  • Searched both open and closed issues for duplicates of this issue
  • Title adequately and concisely reflects the feature or the bug

Restify Version: 10.0.0
Node.js Version: 18.12.1

Expected behaviour

once the response is closed or sent to the client, the "chain handler" must be terminated

Actual behaviour

The "chain handler" still continues when the response has been destroyed

Repro case

case 1:

server.get('*',async(req, res) => {
console.log('----first----');
res.send('first');
}, async(req, res) => {
console.log('----second----');
res.send('second');
});

image

case 2:

server.get('*', async(req, res) => {
console.log('----first----');
res.send('first');
}, (req, res, next) => {
console.log('----second----');
res.send('second');
});

image

Cause

if (!handler || req.connectionState() === 'close') {

Are you willing and able to fix this?

yes

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

No branches or pull requests

1 participant