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(platform-ws): URL parsing error handled #12385

Merged
merged 2 commits into from Oct 5, 2023

Conversation

dbulic-margins
Copy link
Contributor

@dbulic-margins dbulic-margins commented Sep 13, 2023

Invalid URL TypeError handled with a try-catch block

fixes #12381

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #12381

What is the new behavior?

In case of invalid URL socket is closed with an error message.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Invalid URL TypeError handled with a try-catch block

fixes nestjs#12381
@coveralls
Copy link

coveralls commented Sep 13, 2023

Pull Request Test Coverage Report for Build b02a4722-7eed-42bf-9574-6e366bc9c115

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.61%

Totals Coverage Status
Change from base Build df58eebf-9777-4621-ad6a-397c0c18d45a: 0.0%
Covered Lines: 6466
Relevant Lines: 6982

💛 - Coveralls

Copy link
Member

@jmcdo29 jmcdo29 left a comment

Choose a reason for hiding this comment

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

LGTM. How can we make sure this change is tested?

@dbulic-margins
Copy link
Contributor Author

dbulic-margins commented Sep 14, 2023

LGTM. How can we make sure this change is tested?

Added HTTP head to the socket end message for message parsing.
I have tested it on my project (provided screenshots show working connection and closed connection since invalid url).
NOTE: the app DID NOT crash when request on ws://localhost:3001//, just the socket was closed.

I did not manage to create sample project that uses my forked package. Tried to use gitpkg website but keep getting the module @nestjs/platform-ws is not found.
image
image

@dbulic-margins
Copy link
Contributor Author

@kamilmysliwiec I cannot merge this, who else needs to approve?

@kamilmysliwiec kamilmysliwiec merged commit 16c295d into nestjs:master Oct 5, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid URL type error crashes app
7 participants