Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core-internal/src/shared/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ export abstract class Protocol<ContextT extends BaseContext> {
}

private async _oncancel(notification: CancelledNotification): Promise<void> {
if (!notification.params.requestId) {
if (notification.params.requestId === undefined) {
return;
}
// Handle request cancellation
Expand Down
4 changes: 2 additions & 2 deletions packages/core-internal/test/shared/protocol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ describe('protocol tests', () => {
});

describe('notifications/cancelled behavior', () => {
test('should abort request handler when notifications/cancelled is received', async () => {
test('should abort request handler when notifications/cancelled contains requestId 0', async () => {
await protocol.connect(transport);

// Set up a request handler that checks if it was aborted
Expand All @@ -788,7 +788,7 @@ describe('protocol tests', () => {
});

// Simulate an incoming request
const requestId = 123;
const requestId = 0;
if (transport.onmessage) {
transport.onmessage({
jsonrpc: '2.0',
Expand Down
Loading