Skip to content

Commit cbb64bb

Browse files
author
tpp-builder
committed
fix SSEClientTransport endpoint process with none directory sse path
1 parent 98995ec commit cbb64bb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: src/jvmTest/kotlin/client/SseTransportTest.kt

+27
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,31 @@ class SseTransportTest : BaseTransportTest() {
119119
testClientRead(client)
120120
server.stop()
121121
}
122+
123+
@Test
124+
fun `test sse path not root path`() = runTest {
125+
val server = embeddedServer(CIO, port = PORT) {
126+
install(io.ktor.server.sse.SSE)
127+
routing {
128+
mcpSseTransport(path = "/sse", incomingPath = "/messages") {
129+
onMessage = {
130+
send(it)
131+
}
132+
}
133+
}
134+
}.start(wait = false)
135+
136+
val client = HttpClient {
137+
install(SSE)
138+
}.mcpSseTransport {
139+
url {
140+
host = "localhost"
141+
port = PORT
142+
pathSegments = listOf("sse")
143+
}
144+
}
145+
146+
testClientRead(client)
147+
server.stop()
148+
}
122149
}

0 commit comments

Comments
 (0)