receiveOrNull

inline suspend fun <T : Any> ApplicationCall.receiveOrNull(): T?(source)

Deprecated (with error)

receiveOrNull is ambiguous with receiveNullable and going to be removed in 3.0.0. Please consider replacing it with runCatching with receive

Replace with

import io.ktor.server.request.receive
kotlin.runCatching { this.receive<T?>() }.getOrNull()

Receives content for this request.

Report a problem

Return

instance of T received from this call, or null if content cannot be transformed to the requested type.


suspend fun <T : Any> ApplicationCall.receiveOrNull(typeInfo: TypeInfo): T?(source)

Deprecated (with error)

receiveOrNull is ambiguous with receiveNullable and going to be removed in 3.0.0. Please consider replacing it with runCatching with receive

Replace with

kotlin.runCatching { this.receive<T?>(typeInfo) }.getOrNull()

Receives content for this request.

Report a problem

Return

instance of T received from this call, or null if content cannot be transformed to the requested type.

Parameters

typeInfo

type to be received.


suspend fun <T : Any> ApplicationCall.receiveOrNull(type: KClass<T>): T?(source)

Deprecated (with error)

receiveOrNull is ambiguous with receiveNullable and going to be removed in 3.0.0. Please consider replacing it with runCatching with receive

Replace with

import io.ktor.server.request.receive
kotlin.runCatching { this.receive(type) }.getOrNull()

Receives content for this request.

Report a problem

Return

instance of T received from this call, or null if content cannot be transformed to the requested type..

Parameters

type

instance of KClass specifying type to be received.