From f3ecb2ebd81690f7d2d10a21b51d5bc76d1f8c85 Mon Sep 17 00:00:00 2001 From: Ridwan Kasim Date: Sun, 8 Feb 2026 15:58:13 +0100 Subject: [PATCH] [Server] Fix HTTP Transport Header Compliance (#227) * fix: added the Allow header for bad method status code * fix code style --------- Co-authored-by: Tobias Nyholm --- 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 2b1e686..24b2e10 100644 --- a/src/Server/Transport/StreamableHttpTransport.php +++ b/src/Server/Transport/StreamableHttpTransport.php @@ -242,6 +242,10 @@ class StreamableHttpTransport extends BaseTransport ->withHeader('Content-Type', 'application/json') ->withBody($this->streamFactory->createStream($payload)); + if (405 === $statusCode) { + $response = $response->withHeader('Allow', 'POST, DELETE, OPTIONS'); + } + return $this->withCorsHeaders($response); }