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

Fix tests: call end on response, not result of writeHead #543

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/support/sockjs_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ function startServer(port, config, prefix) {
} else {
serve(req, res, function(err) {
var status = err ? err.statusCode : 404;
return res.writeHead(status).end();
Copy link
Contributor

Choose a reason for hiding this comment

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

res.writeHead returns http.ServerResponse, so the previous code should be OK. The docs even say:

Returns a reference to the ServerResponse, so that calls can be chained.

Copy link
Author

Choose a reason for hiding this comment

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

should be... but in reality, the test doesn't pass without the change from this PR.

Have you tried?

Copy link
Contributor

Choose a reason for hiding this comment

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

Which specific test(s) are you referring to?

Copy link
Author

Choose a reason for hiding this comment

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

Here's an example from #534
https://travis-ci.org/github/sockjs/sockjs-client/jobs/761021386#L416

And another from #536
https://travis-ci.org/github/sockjs/sockjs-client/jobs/762011841#L431

If you look the builds for some PRs, there are a number of examples.

res.writeHead(status);
res.end();
});
}
});
Expand Down