Skip to content

Commit 6bae987

Browse files
authored
use SSEClientExcpetion instead of ClientRequestException (#207)
* use SSEClientExcpetion instead of ClientRequestClient * address feedback
1 parent 602881e commit 6bae987

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package io.modelcontextprotocol.kotlin.sdk.client
22

33
import io.github.oshai.kotlinlogging.KotlinLogging
44
import io.ktor.client.HttpClient
5-
import io.ktor.client.plugins.ClientRequestException
65
import io.ktor.client.plugins.sse.ClientSSESession
6+
import io.ktor.client.plugins.sse.SSEClientException
77
import io.ktor.client.plugins.sse.sseSession
88
import io.ktor.client.request.HttpRequestBuilder
99
import io.ktor.client.request.accept
@@ -230,8 +230,8 @@ public class StreamableHttpClientTransport(
230230
requestBuilder()
231231
}
232232
logger.debug { "Client SSE session started successfully." }
233-
} catch (e: ClientRequestException) {
234-
if (e.response.status == HttpStatusCode.MethodNotAllowed) {
233+
} catch (e: SSEClientException) {
234+
if (e.response?.status == HttpStatusCode.MethodNotAllowed) {
235235
logger.info { "Server returned 405 for GET/SSE, stream disabled." }
236236
return
237237
}

0 commit comments

Comments
 (0)