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

Conversation

candrews
Copy link

@candrews candrews commented Apr 5, 2021

No description provided.

@candrews
Copy link
Author

candrews commented Apr 5, 2021

The failing test is because the test doesn't have access to Travis secure variables:

elif [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ]; then

It would pass if run by the main sockjs-client repo.

@candrews
Copy link
Author

candrews commented May 3, 2021

@brycekahle can you please take a look at this PR?

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

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