Skip to content

fix(platform-ws): URL parsing error handled#12385

Merged
kamilmysliwiec merged 2 commits intonestjs:masterfrom
dbulic-margins:invalid-url-typeerror
Oct 5, 2023
Merged

fix(platform-ws): URL parsing error handled#12385
kamilmysliwiec merged 2 commits intonestjs:masterfrom
dbulic-margins:invalid-url-typeerror

Conversation

@dbulic-margins
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

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