trackedJsonBody

inline suspend fun <T> HttpResponse.trackedJsonBody(category: NetworkUsageCategory, json: Json = defaultNetworkJson): T(source)

Reads a response as JSON while counting the exact text bytes received from the server.

Receiver

Ktor response whose body should be counted before JSON decoding.

Author

Dmitriy Moroz

Parameters

category

Traffic bucket that should receive the response byte count.

json

Serializer used to decode the counted response text.