Skip to content

Commit

Permalink
fix: #279 Content-Type header is null (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
epicadk authored Sep 22, 2023
1 parent 2fdc554 commit 159ce45
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.pluto.plugins.network.intercept.NetworkData.Body
import com.pluto.plugins.network.intercept.NetworkData.Response
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.bodyAsText
import io.ktor.http.ContentType
import io.ktor.http.Headers
import io.ktor.http.contentType

Expand Down Expand Up @@ -34,7 +35,7 @@ internal object KtorResponseConverter : ResponseConverter<HttpResponse> {
// TODO handle gzip
private suspend fun HttpResponse.extractBody() = Body(
body = bodyAsText(),
contentType = contentType().toString()
contentType = contentType()?.toString() ?: ContentType.Any.toString()
)

// private fun HttpResponse.isTextType(): Boolean {
Expand Down

0 comments on commit 159ce45

Please sign in to comment.