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(http-server): ensure rejection handler is registered before the error event is emitted #5031

Merged
merged 1 commit into from
Apr 6, 2020

Conversation

raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Apr 3, 2020

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

I don't fully comprehend the changes, but don't see any obvious problems and the CI is green, so LGTM :shipit:

@@ -95,13 +95,15 @@ describe('HttpServer (integration)', () => {
const req = httpGetAsync(server.url, agent);
// Wait until the request is accepted by the server
await pEvent(server.server, 'request');
// Set up error handler for expected rejection before the event is emitted
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note pEvent uses server.server.on('error', ...) behind the scene. We need to call it first so that an error handler is registered before the error event is emitted.

@raymondfeng raymondfeng merged commit 83e78d3 into master Apr 6, 2020
@raymondfeng raymondfeng deleted the fix-http-server-test branch April 6, 2020 16:00
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.

3 participants