Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Fix notification response.id check #18

Closed
wants to merge 1 commit into from
Closed

Conversation

rekmarks
Copy link
Member

A JSON-RPC notification is defined as a JSON-RPC request whose id field is missing. Specifically:

A Notification is a Request object without an "id" member.

The number 0 is a valid ID, but this package will currently erroneously identify requests with id: 0 as notifications. We should fix this.

Note: Should not be merged until id validation is added to json-rpc-engine.

@rekmarks rekmarks requested a review from a team as a code owner May 17, 2021 15:59
@rekmarks rekmarks marked this pull request as draft May 17, 2021 15:59
@@ -63,7 +63,7 @@ export default function createStreamMiddleware() {
) {
let err;
try {
const isNotification = !res.id;
const isNotification = !('id' in res);

Choose a reason for hiding this comment

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

is this true if id is null?

Copy link
Member Author

Choose a reason for hiding this comment

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

isNotification will be false if res.id === null.

@rekmarks
Copy link
Member Author

Superseded by #24.

@rekmarks rekmarks closed this Jul 26, 2022
@rekmarks rekmarks deleted the isNotification-fix branch July 26, 2022 23:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants