Skip to content

Commit

Permalink
Also handle Unit explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
wkornewald committed Jun 18, 2020
1 parent e88cd96 commit 233dc98
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -6,11 +6,11 @@ package io.ktor.client.features.json

import io.ktor.client.*
import io.ktor.client.features.*
import io.ktor.client.features.json.JsonFeature.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.client.utils.*
import io.ktor.http.*
import io.ktor.http.content.*
import io.ktor.util.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
Expand Down Expand Up @@ -110,6 +110,7 @@ class JsonFeature internal constructor(val config: Config) {
context.headers.remove(HttpHeaders.ContentType)

val serializedContent = when (payload) {
Unit -> EmptyContent
is EmptyContent -> EmptyContent
else -> config.serializer.write(payload, contentType)
}
Expand Down

0 comments on commit 233dc98

Please sign in to comment.