Skip to content

Commit 9613cd3

Browse files
committed
Fix content type check in StreamableHttpServerTransport
1 parent abebd98 commit 9613cd3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import io.ktor.server.application.ApplicationCall
88
import io.ktor.server.request.contentType
99
import io.ktor.server.request.host
1010
import io.ktor.server.request.httpMethod
11-
import io.ktor.server.request.receive
1211
import io.ktor.server.request.receiveText
1312
import io.ktor.server.response.header
1413
import io.ktor.server.response.respond
@@ -30,7 +29,6 @@ import kotlinx.coroutines.job
3029
import kotlinx.coroutines.sync.Mutex
3130
import kotlinx.coroutines.sync.withLock
3231
import kotlinx.serialization.json.JsonArray
33-
import kotlinx.serialization.json.JsonElement
3432
import kotlinx.serialization.json.JsonObject
3533
import kotlinx.serialization.json.decodeFromJsonElement
3634
import kotlin.concurrent.atomics.AtomicBoolean
@@ -237,7 +235,7 @@ public class StreamableHttpServerTransport(
237235
return
238236
}
239237

240-
if (call.request.contentType() != ContentType.Application.Json) {
238+
if (!call.request.contentType().match(ContentType.Application.Json)) {
241239
call.reject(
242240
HttpStatusCode.UnsupportedMediaType, ErrorCode.Unknown(-32000),
243241
"Unsupported Media Type: Content-Type must be application/json"

0 commit comments

Comments
 (0)