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 src/Server/Protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ private function resolveSession(TransportInterface $transport, ?Uuid $sessionId,
if ($message instanceof InitializeRequest) {
// Spec: An initialize request must not have a session ID.
if ($sessionId) {
$error = Error::forInvalidRequest('A session ID MUST NOT be sent with an "initialize" request.');
$error = Error::forInvalidRequest('A session ID MUST NOT be sent with an "initialize" request.', self::findRequestId($message));
$this->sendResponse($transport, $error, null, ['status_code' => 400]);

return null;
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Server/ProtocolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public function testInitializeRequestWithSessionIdReturnsError(): void
$decoded = json_decode($data, true);

return isset($decoded['error'])
&& 1 === ($decoded['id'] ?? null)
&& str_contains($decoded['error']['message'], 'session ID MUST NOT be sent');
}),
$this->anything()
Expand Down