fix(ws): fix incorrect host pattern on messages #12321
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
function call was missing the second argument
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently, when using
platform-ws
and callinghost.switchToWs().getPattern()
onArgumentsHost
given in exception filter, we don't get a pattern but we get adata
object. For example for following message on the websocket:we would get
{ test: 1 }
as a "pattern"Issue Number: N/A
What is the new behavior?
When using
platform-ws
and callinghost.switchToWs().getPattern()
onArgumentsHost
given in exception filter we get correct pattern matched for this branch. For the following message on the websocket:we correctly get
'foo'
as a patternDoes this PR introduce a breaking change?
Other information
If I traced the code correctly, currect behaviour happens because the code always gets the last item from the list as a pattern, but on
platform-ws
themessage.event
was never added to that list.I'm not yet fluent with writing for libraries of this size and I didn't see any tests for
platform-ws
or forplatform-socket.io
. That's why I didn't add a test myself. I did see there were some tests forgetPattern()
, but none of them caught this problem. Probably because they were more high-level than the change here.