mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 09:49:25 +02:00
Get request body size on the network thread
This commit is contained in:
parent
1c5b18c2af
commit
196dbcd5a0
1 changed files with 2 additions and 2 deletions
|
@ -66,7 +66,7 @@ class HttpServerApi(private val endpointWithoutSlashAtEnd: String): ServerApi {
|
|||
|
||||
private val JSON = "application/json; charset=utf-8".toMediaTypeOrNull()
|
||||
|
||||
private fun createJsonRequestBody(
|
||||
private suspend fun createJsonRequestBody(
|
||||
serialize: (writer: JsonWriter) -> Unit,
|
||||
measureContentLength: Boolean
|
||||
): RequestBody {
|
||||
|
@ -84,7 +84,7 @@ class HttpServerApi(private val endpointWithoutSlashAtEnd: String): ServerApi {
|
|||
}
|
||||
|
||||
val length =
|
||||
if (measureContentLength) LengthSink().also { write(it) }.length
|
||||
if (measureContentLength) Threads.network.executeAndWait { LengthSink().also { write(it) }.length }
|
||||
else null
|
||||
|
||||
return object: RequestBody() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue