diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt index aef1e430604..73de59ca6ec 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ @file:Suppress("unused") @@ -22,8 +22,7 @@ import kotlin.jvm.* * @see [io.ktor.server.response.ApplicationResponse] */ public suspend inline fun ApplicationCall.respond(message: T) { - // KT-42913 - respond(message, runCatching { typeInfo() }.getOrNull()) + respond(message, typeInfo()) } /** @@ -31,8 +30,7 @@ public suspend inline fun ApplicationCall.respond(message: T) * @see [io.ktor.server.response.ApplicationResponse] */ public suspend inline fun ApplicationCall.respondNullable(message: T) { - // KT-42913 - respond(message, runCatching { typeInfo() }.getOrNull()) + respond(message, typeInfo()) } /** diff --git a/ktor-utils/common/src/io/ktor/util/reflect/Type.kt b/ktor-utils/common/src/io/ktor/util/reflect/Type.kt index 96e3299572f..e144f6602a6 100644 --- a/ktor-utils/common/src/io/ktor/util/reflect/Type.kt +++ b/ktor-utils/common/src/io/ktor/util/reflect/Type.kt @@ -39,7 +39,11 @@ public class TypeInfo( if (this === other) return true if (other !is TypeInfo) return false - return if (kotlinType != null) kotlinType == other.kotlinType else type == other.type + return if (kotlinType != null || other.kotlinType != null) { + kotlinType == other.kotlinType + } else { + type == other.type + } } override fun toString(): String = "TypeInfo(${kotlinType ?: type})"