From 9906bbca32a7976c91b05e11972a8e968d301e6e Mon Sep 17 00:00:00 2001 From: Kasim Ridwan Date: Sat, 24 Jan 2026 15:13:28 +0100 Subject: [PATCH 1/2] fix: added the Allow header for bad method status code --- src/Server/Transport/StreamableHttpTransport.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Server/Transport/StreamableHttpTransport.php b/src/Server/Transport/StreamableHttpTransport.php index 2b1e6869..d93110e9 100644 --- a/src/Server/Transport/StreamableHttpTransport.php +++ b/src/Server/Transport/StreamableHttpTransport.php @@ -242,6 +242,10 @@ protected function createErrorResponse(Error $jsonRpcError, int $statusCode): Re ->withHeader('Content-Type', 'application/json') ->withBody($this->streamFactory->createStream($payload)); + if ($statusCode === 405) { + $response = $response->withHeader('Allow', 'POST, DELETE, OPTIONS'); + } + return $this->withCorsHeaders($response); } From 6287f9401f91b5f0d1350a08ce6852612c5e6733 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sun, 8 Feb 2026 15:48:09 +0100 Subject: [PATCH 2/2] fix code style --- src/Server/Transport/StreamableHttpTransport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Server/Transport/StreamableHttpTransport.php b/src/Server/Transport/StreamableHttpTransport.php index d93110e9..24b2e102 100644 --- a/src/Server/Transport/StreamableHttpTransport.php +++ b/src/Server/Transport/StreamableHttpTransport.php @@ -242,7 +242,7 @@ protected function createErrorResponse(Error $jsonRpcError, int $statusCode): Re ->withHeader('Content-Type', 'application/json') ->withBody($this->streamFactory->createStream($payload)); - if ($statusCode === 405) { + if (405 === $statusCode) { $response = $response->withHeader('Allow', 'POST, DELETE, OPTIONS'); }