Skip to content

Commit 7929ff3

Browse files
committed
use SSEClientExcpetion instead of ClientRequestClient
1 parent 91cf120 commit 7929ff3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.github.oshai.kotlinlogging.KotlinLogging
44
import io.ktor.client.HttpClient
55
import io.ktor.client.plugins.ClientRequestException
66
import io.ktor.client.plugins.sse.ClientSSESession
7+
import io.ktor.client.plugins.sse.SSEClientException
78
import io.ktor.client.plugins.sse.sseSession
89
import io.ktor.client.request.HttpRequestBuilder
910
import io.ktor.client.request.accept
@@ -230,8 +231,8 @@ public class StreamableHttpClientTransport(
230231
requestBuilder()
231232
}
232233
logger.debug { "Client SSE session started successfully." }
233-
} catch (e: ClientRequestException) {
234-
if (e.response.status == HttpStatusCode.MethodNotAllowed) {
234+
} catch (e: SSEClientException) {
235+
if (e.response?.status == HttpStatusCode.MethodNotAllowed) {
235236
logger.info { "Server returned 405 for GET/SSE, stream disabled." }
236237
return
237238
}

0 commit comments

Comments
 (0)