Skip to content

Commit 20472f7

Browse files
committed
use SSEClientExcpetion instead of ClientRequestClient
1 parent 641df74 commit 20472f7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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
@@ -229,8 +230,8 @@ public class StreamableHttpClientTransport(
229230
requestBuilder()
230231
}
231232
logger.debug { "Client SSE session started successfully." }
232-
} catch (e: ClientRequestException) {
233-
if (e.response.status == HttpStatusCode.MethodNotAllowed) {
233+
} catch (e: SSEClientException) {
234+
if (e.response?.status == HttpStatusCode.MethodNotAllowed) {
234235
logger.info { "Server returned 405 for GET/SSE, stream disabled." }
235236
return
236237
}

0 commit comments

Comments
 (0)