HttpClientStreamableHttpTransport: handle HTTP 405
- Fixes #877 Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
parent
7e4c179b77
commit
8e1c5d0cd4
1 changed files with 25 additions and 5 deletions
|
|
@ -298,6 +298,10 @@ public class HttpClientStreamableHttpTransport implements McpClientTransport {
|
|||
"Authorization error connecting to SSE stream",
|
||||
responseEvent.responseInfo()));
|
||||
}
|
||||
else if (statusCode == METHOD_NOT_ALLOWED) {
|
||||
logger.debug("The server does not support SSE streams, using request-response mode.");
|
||||
return Flux.empty();
|
||||
}
|
||||
|
||||
if (!(responseEvent instanceof ResponseSubscribers.SseResponseEvent sseResponseEvent)) {
|
||||
return Flux.<McpSchema.JSONRPCMessage>error(new McpTransportException(
|
||||
|
|
@ -344,10 +348,6 @@ public class HttpClientStreamableHttpTransport implements McpClientTransport {
|
|||
return Flux.empty();
|
||||
}
|
||||
}
|
||||
else if (statusCode == METHOD_NOT_ALLOWED) { // NotAllowed
|
||||
logger.debug("The server does not support SSE streams, using request-response mode.");
|
||||
return Flux.empty();
|
||||
}
|
||||
else if (statusCode == NOT_FOUND) {
|
||||
|
||||
if (transportSession != null && transportSession.sessionId().isPresent()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue