Hello, what is the way to test my ktor client to check that the body is serialised to json correctly ?
a
Aleksei Tirman [JB]
09/14/2023, 1:38 PM
You would receive an exception if the body couldn't be serialized.
l
Lidonis Calhau
09/14/2023, 4:02 PM
Ok thanks, So I would need to use the MockEngine in my test en call it.
If the call fails it means that something might be wrong with serialisation.
Is there way to check value in the json ? like something to get the actual body as string and check values are correct.
a
Aleksei Tirman [JB]
09/15/2023, 7:16 AM
Do you need to check serialization or deserialization?
l
Lidonis Calhau
09/15/2023, 7:53 AM
In this case both 🙂
One is easy because I can mock the response with a string and check the object is correct.
The other one I am not sure how to do.