Also, I'm using `ContentNegotiation`, and trying t...
# ktor
o
Also, I'm using
ContentNegotiation
, and trying to use
receiveOrNull
to 'safely' get a POST body, and it feels much less useful/safe than I'd expect it to be. If I send an empty body or try to instance a data object with non-nullable fields
receiveOrNull
will throw an exception. Is this by design?
b
IIRC, that only returns null if 1) content transformation was successful and 2) the type you expected
receiveOrNull<MyType>()
was not returned by transformation
o
Right, I'm wondering if that's by design, because I have to then be aware of the exceptions thrown by the implementation, or catch something generic like
IOException
if I want
receiveOrNull
to be safe. I always felt that the
OrNull
functions were for situations where you don't particularly care why something failed.