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: pass arguments to server.close #635

Open
wants to merge 1 commit into
base: master
from

Conversation

@KoltesDigital
Copy link

@KoltesDigital KoltesDigital commented Jun 10, 2020

Please ensure that your pull request fulfills these requirements:

  • The pull request is being made against the master branch
  • Tests for the changes have been added (for bug fixes / features)

What is the purpose of this pull request? (bug fix, enhancement, new feature,...)

Rather bug fix.

What changes did you make?

As for server.listen, server.close (both for HTTP and HTTPS servers, as returned by union) takes an optional callback which is called on completion or error. This patch adds argument forwarding for close.

Provide some example code that this change will affect, if applicable:

	const server = createServer({
		root: path.join(__dirname, '..', 'files'),
	});

	await new Promise((resolve) => server.listen(port, resolve));
	
	...

	await new Promise((resolve) => server.close(resolve as any));

Is there anything you'd like reviewers to focus on?

Well there's no tests, should I somehow write one?

As a side note, HttpServer.prototype.close forwards the return value of this.server.close, i.e. this. But HttpServer.prototype.listen does not. I think it should too.

Please provide testing instructions, if applicable:

Above code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.