use SSEClientExcpetion instead of ClientRequestException (#207)
* use SSEClientExcpetion instead of ClientRequestClient * address feedback
This commit is contained in:
parent
602881e283
commit
6bae9874c0
1 changed files with 3 additions and 3 deletions
|
|
@ -2,8 +2,8 @@ package io.modelcontextprotocol.kotlin.sdk.client
|
|||
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.plugins.ClientRequestException
|
||||
import io.ktor.client.plugins.sse.ClientSSESession
|
||||
import io.ktor.client.plugins.sse.SSEClientException
|
||||
import io.ktor.client.plugins.sse.sseSession
|
||||
import io.ktor.client.request.HttpRequestBuilder
|
||||
import io.ktor.client.request.accept
|
||||
|
|
@ -230,8 +230,8 @@ public class StreamableHttpClientTransport(
|
|||
requestBuilder()
|
||||
}
|
||||
logger.debug { "Client SSE session started successfully." }
|
||||
} catch (e: ClientRequestException) {
|
||||
if (e.response.status == HttpStatusCode.MethodNotAllowed) {
|
||||
} catch (e: SSEClientException) {
|
||||
if (e.response?.status == HttpStatusCode.MethodNotAllowed) {
|
||||
logger.info { "Server returned 405 for GET/SSE, stream disabled." }
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue